I'm able to write unit tests test_case.t for a Perl Module ModuleOne.pm
test_case.t
use strict;
use warnings;
use Test::More;
use Test::Cmd;
use ModuleOne; # Included the module here
my $ret = ModuleOne::methodone(args);
is($ret->{val}, 1, "Checking return value"); # success
I'm trying the achieve the same unit test cases for a perl script script_one.pl
script_one.pl
use strict;
use warnings;
use ModuleOne;
my $NAME;
my $ID;
# get parameters
GetOptions (
"name" => \$NAME,
"emp_id" => \$ID,
)
validate_params();
sub validate_params {
# this method will validate params
}
sub print_name {
# this method will print name
}
How can I include this perl file script_one.pl in test_case.t and write test cases for methods validate_params and print_name?