Katalon - how to make an embedded test case data-driven?



  • 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')```
    


  • 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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2