Hello,
I have written a simple test script to do functional verification of an
external application. Let me explain the application first:
I am testing an ticketing application server which get input details in xml
format and provides an acknowledgement for the same. Sometimes, Along with the
acknowledgement it creates an ticket number/id for the accepted request.
Here, A scenario is defined by multiple test cases where for each test the
server is invoked with the input and the resultant output will be used for
subsequent test case. An example scenario, PORT_CREATION:
* Create a customer id - inputs will be details like name, ssn no, etc
* Create a request id for that customer - input will customer id
created earlier, type of request is new internet connection or new phone
connection etc
* Create a port id based on request id - input will be speed of the
connection
* Initiate completion by providing customer id, port id - input will be
date etc...
This is a simple scenario where the subsequent test case uses result of
previous test(s) as input. Data files are maintained for Test scenario and Test
case inputs as individual elements in that xml file. Infact, I have a test data
generation script too.
TS_PORT_CREATION.xml and TS_PORT_CREATION.t files which are test scenario data
file and test scenario Perl file respectively.
In TS_POST_CREATION.t:
--------------------------------------------------------------------------------------------------------------------------------------------
Use TestScenarioExecute;
&Load_and _execute("TS_PORT_CREATION"); #Loads data file and executes each test
case
In TestScenarioExecute.pm:
For each testcase based on the loaded xml file, I am calling the application
server and checking the resultant status( ok($ret, "$testcase returned $ret")).
I have hundreds of similar scenarios and they are getting executed well and
working as expected with test harness. But my doubt is I am having hundreds of
.t files just with two lines of code i.e. loading the module, calling the
subroutine Load_and_execute with the xml file as input. Is it not just a
repetition/code duplication? But I need a way to test the whole suite with
multiple scenarios like this. Is any other way possible.
I am using File::Find::Rule to get the list of test files to be executed
according to the input(i.e PORT).
Please let me know your feedback. Thanks in advance.
Regards,
Murugesan