0
votes

I have a question on the visibility scope of variables. I have two thread groups, each with CSV file and controller containing http request steps, testing the application.

Thread Group1
    CSV file1
    Controller1
        Test Steps1
Thread Group2
    CSV file2
    Controller2
        Test Steps2

Both Controllers use the values in each Thread Group's CSV file just fine. However, I then want to make a Thread Group Combined containing both Controller1 and Controller2

Thread Group Combined
    CSV file1
    CSV file2
    Controller1
        Test Steps1
    Controller2
        Test Steps2

The problem is that the CSV files both use the same variable name, therefore I guess Controller1 and Controller2 don't know which CSV file to use. I still want Controller1 to use CSV file1 and Controller2 to use CSV2. Will a setup like this work?

Thread Group Combined
    Controller1
        CSV file1
        Test Steps1
    Controller2
        CSV file2
        Test Steps2

Thanks for any help!

1

1 Answers

0
votes

If you use a 'Config Element' - It does not matter where you place it - they are like Global variables (Test Plan Scope). They get initialized before your test starts .

Lets assume i have a set up like this.

Thread Group 1
     User Defined Variable (A=100)

Thread Group 2
     User Defined Variable (A=150)  

Now If i run this test - Under Thread Group 1 - If i try to print the value of A, it would be 150. This is because - Scope of these variables are not within Thread Groups - they are global variables.

For this setup,

Thread Group 1

Thread Group 2
     User Defined Variable (A=150)  

Now If i run this test - Under Thread Group 1 - If i try to print the value of A, it would still be 150 even if i do not have User Defined Variables under Thread Group 1.

However - variables you create with Beanshell etc have 'Thread scope'.

So, you might want to use unique variables accordingly.