Each project has test items that specify the tests to be run and which order to run them in. When you add a test item to the project, you can specify parameters for the test that will be run by this test item. But the question always arises as to how to specify parameters for the entire test run?
The easiest way to do this is to create a small script or keyword test that will be run first and will initialize the desired parameters. However, this means you that you have to specify parameter values in your keyword test or script code, that is, you have to modify the test sources before running the test. If you do not want to modify the sources, use any of the solutions listed below.
You can set up a small text file with a parameter string in it, and have the initialization test read the parameters from there. But in this case, it has to interpret them itself.
You can use the
You can pass parameters via the TestComplete command line. To obtain the value of these command-line arguments, use the
BuiltIn.ParamStrfunctions. Use the Call Object Method operation to call those functions from a keyword test.
You can use project and project suite variables. The values of these variables depend on the machine where the test is run. In other words, the values of these variables differ from one tester’s computer to another. These variables depend on how their values are shared: project, project suite and network suite.
Once a variable has been created, it appears in the Code Completion window under the Project > Variables or ProjectSuite > Variables node. To access existing variables in a test, use the
ProjectSuite.Variables.variable_namesyntax correspondingly. For instance the following code reads the value of a project variable
def Main(): LoadDataFromFile(Project.Variables.MyExportFilePath) ...
C++Script, C#Scriptfunction Main()