I’m sorry Hanh Tran, but this is not a right answer for my problem.
It seems to me you don’t understand what I need to do.
The GlobalVariable in a Test Collection is reset at every Test Suite start and than the Login step is repeated. After that there is another problem: every test suite close the browser also without WebUI.closeBrowser().
So things are getting complicated. What you are trying to do will break the usual flow of test suite if you execute it separately. I suggest that each Test Suites should be independent of each other , do not try to mess it.
I can suggest you the following workaround by having ‘gl_isLogin’ variable (default is true)
if (already logged in)
GlobalVariable.gl_isLogin = true
//Not logged in yet, insert login steps below
End of ‘Login’ Test Case before you trying to close browser
Glno, I don’t know if you have solved this problem, but as far as I understand, Test collection will close the browser after every test suite. What you need here is a single test suite with multiple test cases and a LISTENER for every action you wish to perform AFTER login.
Create a listener with “Before Test Suite” and “After Test Suite” options ticked and just call the login test case and logout test case in it. Something like this
This design of Katalon studio is frustrating. Katalon automation recorder has better capability here.
Let me give an example of my use case.
My team provides a web form with complex validation rules. There is a default form, and there are 10 simpler variations of it.
To test the validation of any section, all the sections above it must be populated with valid data.
I made 8 test cases for the standard form that test each section of the form in Katalon automation recorder. I run all 8 test cases within a test suite.
To test a new variation of this form:
I copy the test suite.
Then I change the URL of the first test case.
I change assertions that test the H1 and title text.
Then I remove test cases that do not apply to that form variation
And I modify other test cases, e.g. the form variations for countries hide country field and pre-populates it, so I test that the field exists, and that it is populated with the correct country.
This has worked OK for my team.
Two issues are:
parts of the validation are complex and would be easier to do with data-driven testing
we would like to use a service like browserstack to cross-browser test.
So I migrated the tests to Katalon studio to solve these issue. But the test suite will not run because the browser is closed between each test case, losing all the data in the form. If I combine all the test cases into one, then I lose modularity and the tests are much harder to re-use.