Did You Know: How QTP identifies Test Folders?
You would have probably used the Test Batch Runner tool to batch run your test scripts (If you are not aware of it, Test Batch Runner is a tool provided by QTP to run multiple tests in succession). In the Test Batch Runner tool, you need to click on the Add icon and then select the test folder to add it to the batch.
However, an important question that arises here is how does QTP identify that the folder we have selected is actually a test folder and not a normal one?
The answer to this is the question is the Test.tsp file available in the Test folder. When we try to open a test from the Test Batch Runner tool or from QTP itself, QTP tries to find out if the folder that we are opening contains the Test.tsp file or not. If the folder doesn’t contain the Test.tsp file QTP treats is as a normal folder. But if the folder contains Test.tsp file, QTP considers it as a Test folder.
Please note that only the file name Test.tsp decides whether a folder is a test folder or normal one. The contents inside the file doesn’t affect this decision.
Let’s see an example to understand this more clearly.
1) We have created a sample test case named ‘Sample Test’ which contains the Test.tsp file as shown in the below figure.
2) Open Test Batch Runner tool and add the ‘Sample Test’ to the Batch Runner tool. The test gets added to the tool as shown in the below figure.
3) Now delete the Test.tsp file from the ‘Sample Test’ folder. Try adding the test again in the Test Batch Runner tool. Now you’ll not be able to add the test case to the tool because this time QTP recognizes ‘Sample Test’ as a normal folder and not a test folder.
4) Create a new Dummy Folder. Open a new notepad file and save it as Test.tsp in the Dummy Folder as shown in the below figure.
5) Try adding this Dummy Test to the Test Batch Run tool. You would notice the QTP identifies this dummy folder as a test folder and adds it successfully in the Batch Run tool as shown in the below image.
The above example shows how QTP identifies test folders and differentiates them with the normal folders. Can you now use this information together with Windows Scripting, VBA and QTP AOM to create your own Test Batch Runner tool? Try it out and let us know how far you have reached.. :–)