0

Hello I need to login to an app and then make a product selection, with several different products (as a data driven script). The login script & product selection script will be used by other test cases. The test suite only gives option to map excel data for the 'main' test case, and won't iterate through all rows of product selection data for the test case that is called. Any way to test all my login profiles without lots of duplicated code please?

edit - added code below:


1. WebUI.callTestCase(findTestCase('Login'), [:], FailureHandling.CONTINUE_ON_FAILURE)
2. WebUI.callTestCase(findTestCase('SLP/Common/Product Selection'), [('Product A') : findTestData('SLP/ProductFees').getValue(
            'Product A', 1), ('Product B') : findTestData('SLP/ProductFees').getValue('Product B', 
            1), ('Product C') : findTestData('SLP/ProductFees').getValue('Product C', 1), ('Product D') : findTestData(
            'SLP/ProductFees').getValue('Product D', 1), ('Product E') : findTestData('SLP/ProductFees').getValue(
            'Product E', 1), ('Product F') : findTestData('SLP/ProductFees').getValue('Product F', 
            1), ('Product G') : findTestData('SLP/ProductFees').getValue('Product G', 
            1)], FailureHandling.CONTINUE_ON_FAILURE)
3. Delay
4 add customer data, like name, address etc etc
5. test case goes on for further 20 rows and then some if/else statements required to validate the product selection earlier (like what conditional fields are present)

Below is an extract of the 'Product Selection' test case called at step 2 above, it uses variables set in the test case (eg 'Product A' etc):

if (Product A == 'Yes') {
    WebUI.click(findTestObject('Product Display/btnProductA'))
} else {
    println('Product A not chosen')
}

if (Product B == 'Yes') {
    WebUI.click(findTestObject('Product Display/btnProductB'))
} else {
    println('Product B not chosen')```
  • 1
    Please share what you've done, your code. That way we can help you better and faster. – pavelsaman Dec 8 '19 at 15:34
  • Hi - edited post above - if it helps,found similar on forum (no answer): forum.katalon.com/t/call-test-case-and-variable/20554/4 Hey, Below is what I am trying to do test case A has variable Call test case A into test case B but would like to pass the variable data Create a test suite which uses test case B but use test data to pass the test data from Excel into test case B The problem is I am not defining any variable into test case B since I am just planning to use data from test case A but when I map data into test suite it does not detect test case A variable – user8217234 Dec 10 '19 at 15:41
1

Ok, looks like it has been asked here and the solution works: https://forum.katalon.com/t/assigning-values-in-variables-for-called-test-cases/14543

The variables should be declared in the called test case AND the main test case. My problem was having variables declared only in the called test case

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.