Forum Discussion

Saira16's avatar
Occasional Contributor
5 years ago

Run test cases in multiple environments for desktop application

I am working with desktop application. We have around few test cases and these has to be run on multiple environments. We are writing scripts and not keyword tests. By passing path of environment as project variable, i am able to run in one environment without issue. But I want to run all these test cases in all the environments without changing the variable value manually everytime. And i want selection option of testitem from project.

Is it possible to iterate by number of items in tested apps or to set iteration count of parent case from script? Is there any other way to iterate with different environments?
Please help me as i am stuck here.
  • Saira16,


    In Azure DevOps there are two ways of doing this that I have tried. 


    1) use a command line approach to update your settings file. Something like in the image below

    2) use  the option of giving the input to a variable at run-time. When you click deploy you can set values to your variable but that would require you to manually deploy the stage 8 times. Or add 8 different stages.




11 Replies

  • Wamboo's avatar
    Community Hero



    The second solution is to:


    1) Run Your project with cmd and pass a variable with 'testedApp name'

    2) Read cmd variables inside Your's scripts using TestComplete BuiltIn object

    3) Pass these values into Project variables

    4) Compare these values with the object inside Your unit file:

    var obj = {

       'trunk' : {

              'testedAppName': 'pathToApp'



    5) set this app in TestedApps.positionName.Path

    • Saira16's avatar
      Occasional Contributor
      Thanks for solution. I will try it and let you know on its working.
  • Hi,

    Since people have already given you the idea of using a data/environment file and you want to handle test items as well. You can look into jenkins for this particular task.  TC has very good integration with it.


    You can use choice parameter (or a number of other plugins) to select environemnt and test items to run for every indiviual run.  


    • Saira16's avatar
      Occasional Contributor

      I tried by passing values from cmd prompt and use it, it worked with the approach. One issue i have is, i am going to run against 8 instances, which has different paths for opening the file. If i use devops pipeline, then should i handle it?(I am new to devops pipelines also). I have an idea of implementing a powershell script which will run one instance after other, will this work with ci-cd approach by calling the powershell script, i am sorry if this is a basic question, but as i am starting with this ci-cd approach i have so many question?

      • Reshail's avatar

        Hi Saira16,


        What I've understood so far is that you want to run your test case on 8 different settings one after another. If thats the case you can add multiple build step for test complete or just write a groovy script to iterate through your settings. You can also use the power shell approach by adding multiple power shells. 

        All of this depends on what CI-CD tool you're using. So share that and I am sure someone here will be able to help you.




  • BenoitB's avatar
    Community Hero

    One possible way is the following.


    1 - Make a file with the list of the environment path

    2 - Load this file

    function loadData() {

       // Read your file, even a single text file if you want and put the

      // list of path in an array ListOfPath


    3 - Make a function which call all tests cases and which llop with them with the value of environment path that you iterate

    function doTests() {

      for (let i=0;i<ListOfPath.length;i++) {

        currentPath = ListOfPath[i];



        // and so on...




    If the pathes are fixed for a while, use a table in the Store of TC instead of an external file.

    External file is good if you often change.




    • Saira16's avatar
      Occasional Contributor
      Thanks for your solution, but i wanted to have test case selection from test items directly, as i want to give option for users to select their test case and run.
      • Wamboo's avatar
        Community Hero

        Alright, so use Project variables and put it inside a single test item parameter.