Forum Discussion

tbom's avatar
tbom
Contributor
13 years ago

Passing parameters to testexecute when using COM automation

Is it possible to pass parameters (or set projectsuite variables) when I use testexecute via COM Automation



I need to set a parameter on startup, to specify if a testrun is in development or production.



I could do it with a testcase that I enable / disable as required via COM, but i don't like that idea that much.. 



/ Thomas
  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    I am currently updating all our test management apps, including our automated test distributed client (that runs on every test VM and selects and runs tests according to priority/status) to support an additional product and second cluster of test machines, and I have run into this issue as well. What I did was create a routine in both test projects that takes a string parameter (i.e. "PARAM1|PARAM2|PARAM3"...) and modifies appropriate variables, and call this through the RunRoutineEx method of the Integration object before each test.



    http://support.smartbear.com/viewarticle/27010/



    It's ugly, but managable. It's the only way I was able to make this work, as somehow the intended way of doing this through COM requires that a test is running to be able to modify a variable, and there is no way to pause a test through COM... So if I use this method I have no guarantee that the variables will be changed before they are read by the test.



    I am still waiting for an answer as to what the reasoning was behind this implementation of the API... It really makes no sense, good design would have been to have all the .Variables collections in Project and ProjectSuite made directly accessible through the Integration object as soon as the project suite is loaded...