Two array list in two test cases

Hello,
Created Two array list global Variables
arraylist1
arraylist2

In test case 1 I get arraylist1 as an output
In test case 2 I get arraylist2 as an output

I created a test suite collection to run the both of them Then use a Test case 3 Which is a compare function that takes Arraylist1 and Arraylist2 as inputs and compare them

My problem is:
Both array lists are empty in TestCase3 so when i print them or compare them they say that i have two empty lists even though i ran TC1 and TC2 before TC3
I tried it in a sequential and parallel way apparently it doesn’t work both ways
the arrays are not empty in their individual test case

is there a way that i can get the outputs from the others tezt cases into the third one so i can compare them

Do you know we have 3 categories: “Test Case” < “Test Suite” < “Test Suite Collection”.

In your description above, you used “Test Case” and “Test Suite Collection”, but you neglected “Test Suite”.

How did you use “Test Suite” in your case?

The test suite is techincally a test case
Test suite 1= Login test case+ Function testcase (Gets me array list 1)
Test suite 2 = Login2 test case+ Fucntion2 test case (Gets me array list 2)
Test suite 3 = compare function (Compares array list1 and array list 2 )

Test suite collection = Test Suite 1 + Test suite 2 + Test suite 3

An instance of GlobelVariable is scoped within a “Test Suite”.

2 Test Cases in 1 Test Suite can share a GlobalVariable’s value.

2 Test Suites can not share a GlobalVaraible’s value.


If you want to keep 3 Test Suites in a Test Suite Collection and share information, then GlobalVariable is not suitable. You should save & load data in a file.


okay understood
Any idea then for how to save them or where so i can use them ?

Any method you can choose in Java.

Katalon Studio does not offer any support.

@GIO The way to structure your TC is create a Test Suite that ONLY runs TC3. Inside TC3, set both Global Variables to empty, then CALL TC1 (this will fill your first Global Variable), then right afterwards, CALL TC2 (this will fill your second Global Variable) and then you have the comparison code of TC3.

GlobalVariable.gArrayOne = []
GlobalVariable.gArrayTwo = []

WebUI.callTestCase(findTestCase('path to TC1', [:], FailureHandling.OPTIONAL))

WebUI.delay(1)

WebUI.callTestCase(findTestCase('path to TC2', [:], FailureHandling.OPTIONAL))

WebUI.delay(1)

"now compare gArrayOne to gArrayTwo"
blah blah blah

If you don’t do it something like this, then you should look into another method, like saving your references and not Global Variables.

Edit: fixed the call to test case

@grylion54

You forget to call WebUI.callTestCase()

I would rather write TC3 as follows:

// Test Cases/TC3

GlobalVariable.gArrayOne = WebUI.callTestCase(WebUI.findTestCase('path to TC1'), [:], FailureHandling.OPTIONAL))

GlobalVariable.gArrayTwo = WebUI.callTestCase(WebUI.findTestCase('path to TC2', [:]), FailureHandling.OPTIONAL))

"now compare gArrayOne to gArrayTwo"
blah blah blah

Is it doable like the following in a test suite? and it will get me the Test suite list variables?

GlobalVariable.CompareList1 = WebUI.callTestCase(WebUI.findTestCase(‘Test Suites/Schedules/GetByCustomersAndBranches_Web’), [:], FailureHandling.OPTIONAL);

GlobalVariable.CompareList2 = WebUI.callTestCase(WebUI.findTestCase(‘Test Suites/Mobile/GetCustomersAndBranches_Mob’, [:]), FailureHandling.OPTIONAL);

I can not understand your question because possibly you are using the term “Test Suite” wrongly .

Do you mean “Is it doable like the following in a Test Case?”

What i mean
.findTestCase fucntion, can i give it a test suite path instead of test case
Or does it only work on Test Cases

I can not understand this at all.

Possibly you should forget all of “Test Suites”. You should be able to build a solution with 3 Test Cases. No Test Suite required.

This is the path you mentioned
if it isnt like that is there a way i can get the Test Case path ?
““GlobalVariable.gArrayOne = WebUI.callTestCase(WebUI.findTestCase(‘path to TC1’), [:], FailureHandling.OPTIONAL))””

okay then ishall forget test suites

No. You are wrong. I did not mention such nonsense.

here u mentioned it

No, you misunderstood.

I mentioned 'path to TC1'.

Then you wrote ‘Test Suites/Schedules/GetByCustomersAndBranches_Web’, which is nonsense to me.

Don’t you understand?

May be no.

You do not understand what a “Test Case” is, what a “Test Suite” is, and a Test Case is not equal to Test Suite.

You wrote before:

This proves that you are confused. That’s the point why you are struggling yet.


Sorry, I will quit this discussion.

I understood your point and i was asking if it works anws i fixed it now and gave it a TC path
and i will try it