Defined package and mport it from testcase class.but it is not calling any methods

I’m a beginner to use package endpackage
I have used package which includes from base packet class to environment class.
package d_pkg;
include "d_env.sv" include “d_sb.sv”
include "d_mon.sv" include “d_drv.sv”
include "d_gen.sv" include “d_con.sv”
`include “d_base.sv”
endpackage

then I called it through import d_pkg::*; from testcase class. but it is not calling any of the classes

import d_pkg::*;
class testcase;
virtual dff_if intf;
env env1;
config1 cfg1;
function new(virtual dff_if intf);
this.intf=intf;
env1=new(intf);
$display(“env created”);
endfunction

task run();
$display(“testcase started”);
cfg1=new();
cfg1.num_txn=4;
env1.gen.cfg1=cfg1;
$display(“env gng 2 start”);
env1.run();
endtask

endclass

it is not creating env1 object memory . please tell me how do I use package in verification environment

In reply to suresh M:

Where are you instantiating your testcase class? You need to have a top level module where you instantiate your testcase and call run.

In reply to cgales:
yes I used instantiation of testcase class at testbench program block then I used top module from there I instantiate dut, testbench and interface.
`include “d_test.sv”
program testbench(dff_if.tb intf);

testcase test;

initial begin
test=new(intf);
test.run();
end

endprogram

//top module

include "ff_dut.sv" include “d_intf.sv”
`include “d_tb.sv”

module top();

bit clk;
initial
forever #5 clk=~clk;

dff_if intf(clk);
ff inst(intf);
testbench tb(intf);

endmodule

during compilation , I got this error

Error: d_test.sv(4): Could not find the package (d_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.

** Error: d_test.sv(8): Invalid type ‘env’. Please check the type of the variable ‘env1’.

** Error: d_test.sv(9): Invalid type ‘config1’. Please check the type of the variable ‘cfg1’.

** Error: d_test.sv(12): Undefined variable: env1.

** Error: d_test.sv(13): Undefined variable: cfg1.

** Error: d_test.sv(22): Undefined variable: cfg1.

but I imported package in testcase class
please tell me the reason

In reply to suresh M:

Is this the same error that you originally described? This seems to be something different.

Before you can import a package, you need to make sure that it is compiled. Don’t use include to compile packages or include other components.

Your compilation flow should look something like:
vlog d_pkg.sv
vlog d_test.sv (Note: Your tests should be within their own package)
vlog testbench.sv

Also, never use a program block. Use a module definition instead.