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

Hi @dikshika114 

 

I think there is a misunderstanding. 

 

I said to use 4 separate variable values/ Test Parameters. 

 

This will ensure each test will use a different value

 

test1 - variable value 1 - parallel session 1

test2 - variable value 2 - parallel session 2

test 3 - variable value 3- parallel session 3

test 4- variable value 4- parallel session 4

 

With regards deleting from the data base, this is done in an iterative basis. 

 

Either done prior to running a test, or after you run the test.

 

The key is when you run the test you will not be blocked from using that same variable/parameter again. 

 

As mentioned before also would be a set variable value using a code expression mode

 

Using say reg ex or something similar you could add generate values to be added and avoiding the deleting from the DB but it means lots of test data in your DB. 

 

Hope this clarifies any confusion on the approach I suggested

 

KR

 

Vincent 

ebarbera
Staff

Hi @dikshika114 - 

 

It is still possible to avoid deleting the posts with my approach - i think you will find this a bit more streamline. 

 

Let me know your language of choice. 

 

Emma

Hi @ebarbera 

 

I am using JavaScript. Please share a sample code for that.

 

Thanks

Dikshika

Hi @dikshika114 - 

 

Great thank you!

 

function UniqueUserDatanew()
{
Project.Variables.UniqueUserNum = ++Project.Variables.UniqueUserNum
Project.Variables.UserEmail = "testuser" + Project.Variables.UniqueUserNum

}

 

This is an example of the script - in order to make this work you will have to add the project variables at the project level - (same approach can be used for username)

 

ebarbera_0-1639058340284.png

In your test you will have to run the script routine at the start of the test to generate the unique values - and then change out the constant values for the variables:

 

ebarbera_1-1639058465540.png

 

Please let me know if you have any questions or if part of this doesnt make sense. 

 

Thanks, 

Emma

Hi @ebarbera 

 

I have implemented the code and the suggestion that you provided but it's not working.

It's taking same value for different browsers like Chrome, Edge and Firefox while running parallelly with CBT.

Due to which my script is passing only for one browser and failing for other two. Because duplicate email can't save in my system.

 

Eg: UserEmail = testUser5@gmail.com for all three browsers. So, my problem is not solved.

I want 3 values parallelly like:

Chrome: UserEmail = testUser5@gmail.com

Firefox:  UserEmail = testUser6@gmail.com

Edge: UserEmail = testUser7@gmail.com

 

I need Different value for different browsers that are running parallelly.

dikshika114_0-1639246205215.png

 

Thanks

Dikshika

Hi @dikshika114

In this case my two ideas would be to use a random number function for a portion of the email. Also you could try using logic to determine which browser is running and having unique versions of the email address per user.

Let me know if you have further questions.

Emma

Hi @ebarbera 

1. Can you explain the Random number function?

2. Can you please provide a detail exaple with sample script for your second thought?

3. How can we check, which current browser is running on remote with CBT to apply the TestData Conditions accordingly???? @ebarbera 

 

Like How much variables i will have to create for that?

and How it will work for 3 browsers?

 

Thanks

cancel
Showing results for 
Search instead for 
Did you mean: