Ask a Question

Run Script with CBT (Parallelly) after using different data from excel

dikshika114
Contributor

Run Script with CBT (Parallelly) after using different data from excel

I wanna run my script (Which is written in JavaScript) thru CBT on 3-4 browser and i want to use different different data from the excel for each browser running parallelly in with CBT.

Is it possible to do that?? If yes, what would be the Best way to do it??

16 REPLIES 16
vinniew
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @dikshika114 

 

Hope you are well. 

 

Data driven loops will run the sessions in parallel but use the same data. 

 

To best ensure each session use different data then I would recommend maybe using parameters or even a table variable in TestComplete. 

 

This may involve some duplication as each test will need to reference a different table variable. 

 

The great thing about parameters is that they can be called on execution(say your parallel execution group) or parsed into a test however Parameters are configured in TestComplete rather than an excel value.

 

See here for more information 

https://support.smartbear.com/testcomplete/docs/testing-with/running/tips/test-run-parameters.html

 

Hope that helps

 

Vincent    

mattb
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi, 

Like Vincent said you could do this through Data driven testing, I think it would be easiest through a TestComplete table variable, where you can use the data generator to generate dynamic data. https://support.smartbear.com/testcomplete/docs/testing-with/data-driven/generators/index.html 


dikshika114
Contributor

Re: Run Script with CBT (Parallelly) after using different data from excel

I have lot of values that i saves uniquely in the system. So, i just want to specify these values at one place that could easily be changed before start execution like in excel file.

 

Unable to understand the way, how it can be called differently while Parallel execution with CBT. (I have configured the Browser and Platforms in Execution Plan Like shown in Screenshot)

dikshika114_0-1638888454579.png

 

Please explain the way somewhat deeply. How can i do that. Because i have no idea about that.

Attaching the screenshot of my excel file also where data is separated with test case and the field names which i want to change for every browser which are running parallelly.

dikshika114_1-1638888741702.png

Please provide a straight away sample script to achieve that.

Thanks

 

vinniew
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @dikshika114 

 

Can I ask what is the significance  of using different data in each parallel session? 

 

How does that affect your approach to functional testing? 

 

If it is an absolute requirement, I would recommend the following:

-  Create 4 table variables using the structures you have referenced in excel.

You will need to manually create 4 variables, with each type as table

https://support.smartbear.com/testcomplete/docs/testing-with/variables/index.html

 

- Create 4 of the same tests but with a different name and put them into the parallel group

-Each test will refer to a different table variable on execution in CBT

 

As I have mentioned already, this approach requires some more maintenance however if its required then this will achieve it for you. 

 

KR

Vincent 

ebarbera
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @dikshika114 -  

 

Is the requirement that the data can only be used once? Or just cannot be used in the parallel environments?

 

Thanks, 
Emma

dikshika114
Contributor

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @ebarbera The requirement is: Data can be used once.

You can understand it in that way like: we can't register for Gmail with a same email ID. Means Email ID or user name can't be duplicate in the system.

vinniew
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @dikshika114 

 

Thanks for adding clarity. 

 

In that case using 4 separate Variable values as mentioned already will work. 

 

https://support.smartbear.com/testcomplete/docs/testing-with/variables/index.html

 

You may want to run a script against the DB to delete the registered users after running the test or before you run the next iteration of tests. 

 

This will reduce the amount of dummy data generated on your DB and reduce duplication of data meaning you can use the same data in each time you run a test. 

 

Also that script execution can be included in Testcomplete runs if needed. 

 

https://community.smartbear.com/t5/TestComplete-Questions/Batch-script-not-running-through-TestCompl...

 

You can manually do this too if it suits however doing the above approach could also enable you use parameters too as they would be deleted from the DB 🙂  

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/parameters.html

 

One last option to consider would be using a set variable value operation. 


Here you could grab a value, say an onscreen value  and setting a value using using Mode: code expression, you could parse or add context to the email being used. 

 

Here is some info on code expressions 

https://support.smartbear.com/testcomplete/docs/keyword-testing/basic/operation-parameters.html#Expr...

Set variable value operation

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/set-variable-va...

 

So it looks like you have a couple of approaches to achieve this 

 

Try them out and see how you get on 

 

KR 


Vincent 

 

dikshika114
Contributor

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @vinniew 

As you said, "delete the registered users after running the test or before you run the next iteration of tests." It's not possible when test cases

are running parallelly with CBT. 

Take an Example:

 

Location               City        State

United States       US          US

 

This data is using by Chrome, Edge, Safari, Firefox Parallelly. Then it can be possible like anyone can save it first and then the script for other 3 browsers will fail because we have a validation there like: Location Can't be duplicate. So.......... Other 3 are getting failed. So, how can i handle that. 

Please specify exact steps. I am trying it with table variable but i think i didn't reach to the exact path.

 

Also, unable to understand how can i use data generator?

ebarbera
Staff

Re: Run Script with CBT (Parallelly) after using different data from excel

Hi @dikshika114 - 

 

I would actually recommend in this case writing a short script to generate unique data each time - which is your language of choice? I can write an example for you. In this case you will not have to delete any records!

 

Thanks, 

Emma

cancel
Showing results for 
Search instead for 
Did you mean: