What is a testbench in Verilog?

A testbench is a non-synthesizable module used to simulate and verify the functionality of a design under test (DUT).

Write a simple testbench in Verilog :
module testbench;
reg clk, d;
wire q;

// Instantiate the DUT
DFF dut (.clk(clk), .d(d), .q(q));

initial begin
    clk = 0; d = 0;
    #5 d = 1;
    #10 d = 0;
    #20 $finish;
end

always #5 clk = ~clk; // Clock generation
endmodule