In the modules/multi-module applications I write, I create separate config files in the t/ directory that are configured for specific tests.
In my module/program files, I load the configs something like this:
my $conf_file; if ( exists $ENV{'CONFIG'} ) { $conf_file = $ENV{'CONFIG'}; } elsif ( exists $params->{config} ){ $config_file = $params->{config}; } else { $conf_file = '/usr/local/etc/program.conf'; }
Then, near the top of each test file for example...
my $conf = abs_path( 't/conf/this_test.conf-dist' ); $ENV{'CONFIG'} = $conf;
In that way, each test script can have its own config file that is predetermined, and consistent. If you're not testing against a config itself, I don't see it wise to modify it on the fly during testing. I prefer to have static data so my tests are reliable.
-stevieb
In reply to Re: Please suggest the best way .ini or pm
by stevieb
in thread Please suggest the best way .ini or pm
by bhushanQA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |