Forum Discussion
Hi Alex,
well my goal is, with the first TextExecute call, to prepare the test items for the second call (i.e. enable/disable a subset according to a parameter I may providevia external file that the vbs will be able to read data from).
I'll give you an example:
suppose I have a test suite (mySuite.pjs) with a project (call it myTestProject.mds) having two test groups:
NOREGRESSION_TESTS, with 12 test items
and
PERFORMANCES_TESTS, with 8 test items.
Then I write a vbs (name it testsetup.vbs with a routine called "prepareTests") placed inside the myTest.mds project, that is able to enable all the NOREGRESSION_TESTS or PERFORMANCES_TESTS according to a parameter.
My first call to TestExecute could be (supposing I wrote onto a parameter.txt file the word NOREGRESSION_TESTS) :
TestExecute.exe "C:\Work\SmartBear\TestExecute\Projects\mySuite.pjs" /r /exit /p:myTestProject /u:testsetup /rt:prepareTests
My second call would be:
"C:\Work\SmartBear\TestExecute\Projects\mySuite.pjs" /r /exit /p:myTestProject
The prepareTest sub would read from the parameter.txt file the group of tests that must be enabled and do that accordingly. Exiting I expect that those setting would be saved (as in Testcomplete) so the second call would get those tests enabled and execute them.
I hope I was clear on this!
It's a bit tricky and in order to do this you need external files describing the tree of test items (for me just simply the two groups but sometimes I guess I would need to be more deeply specific with that enabled list).
What I wanted to avoid was just that step, that's why I wante to read all the test items via COM (of course using a hidden TestComplete instance, which performs all the COM requests) with a C# form application, let the user via a UI choose what to set/unset, save the project and close all, leaving to the TestExecute command line (just the second one) the test execution.
Hi Silvio,
Well, it is not possible to programmatically change the state of test items from within TestComplete/TestExecute according to my knowledge.
Thus, I would suggest these two options (conceptually they are pretty similair and selection of this or that one will probably depend on your personal preferences and implementation conveniences):
-- Instead of executing the code that sets the state of test items from within TestExecute, you need to create a standalone script and execute it out of TestExecute. This script will enable the required test item(s) via direct modification of the project file as discussed previously. Then you will start TestExecute with the command line parameter specifying what test item must be executed.
-- If you like to have interactivity, you may consider to create a User Form in your test project and create a code that will get the list of project test items, populate User Form with this list and display the form to end-user. End user will specify (via Ctrl-clicking) what test items must be executed. Names of the selected test items are saved then to the external file (e.g. parameter.txt) and TestComplete/TestExecute must quit. The obtained file is then processed by the above standalone script.
P.S. Note, that if test items in your test project are organized hierarchically, only the initial test item that test execution starts from must be enabled. Its parent item(s) may be enabled or disabled. The state of child items defines whether or will they be executed during test run.
Related Content
- 3 years agothaidy