cancel
Showing results for 
Search instead for 
Did you mean: 

Run test cases in multiple environments for desktop application

SOLVED
Highlighted
Occasional Contributor

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.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

@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

Reshail_1-1586865911855.png

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.

 

 

 

View solution in original post

11 REPLIES 11
Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

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];

    myTestNumberOne();

    myTestNumberTwo();

    // 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.

 

 

 

Un sourire et ça repart

Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

Hi,

 

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

Highlighted
Occasional Contributor

Re: Run test cases in multiple environments for desktop application

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.
Highlighted
Occasional Contributor

Re: Run test cases in multiple environments for desktop application

Thanks for solution. I will try it and let you know on its working.
Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

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

 

 

Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

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.  

 

Highlighted
Occasional Contributor

Re: Run test cases in multiple environments for desktop application

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?

Highlighted
Community Leader

Re: Run test cases in multiple environments for desktop application

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.

 

Thanks

 

Highlighted
Occasional Contributor

Re: Run test cases in multiple environments for desktop application

Thanks for your response. I will be using azure devops for both version control as well as pipelines.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors