Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
"including" perl scripts on the fly and leaving them controlledby demoralizer (Beadle) |
on Mar 18, 2014 at 17:20 UTC ( [id://1078823]=perlquestion: print w/replies, xml ) | Need Help?? |
demoralizer has asked for the wisdom of the Perl Monks concerning the following question: Hello, we've a test framework written in perl and I'm not sure if the implementation is done really wisely. There is a general test runner that opens a simple text file that includes all the perl test files that have to be executed. This file is read and put on a test case stack. That makes it easy to include further tests during run time what is needed in certain cases, e.g. if I press ctrl+c the current test case will be stoppend and another test case that shows an input line is inserted on stack for beeing executed next. Furthermore there are several helper packages that make implementing test cases very easy. The test runner and each test case "uses" all these packages. In the helper packages there is also a hash that is used by all test cases where variables can be defined that can be used and modified by the tests Currently I'm using "do" to execute each test case inside the test runner environment. Otherwise the test wouldn't be able to handle e.g. those common defines and other things that should be seen by the test runner. Each test can consist of several test procedures that each can fail and pass and in critical cases can make the whole test or even the test runner beeing stopped All test cases run in the same package "TESTCASE" that is undefined after a test case has been executed. So test cases don't come into conflict with others but e.g. all see the same HELPER package. Here is some (pseudo) code example to make it a little bit clearer: helper.pm: testcase1.pl:
Puh, a lot of stuff so far... I hope it's not too much for one issue but I think in that way my problem becomes clearer. Here are my questions: By the way it's only sample code, the real test runner is much larger and many more different results are handled but this should show my problems Thanks a lot in advance!
Back to
Seekers of Perl Wisdom
|
|