How do I set multiple variables from the same sql call?

I tried searching for the answer in the forums but have come up short. I have a sql query that returns a random user. I’m trying to store the results of that query into two separate variables, a first name and a last name. The problem is the way it’s being done, the db is being queried twice and therefore returning a different user when trying to store the last name.

WebUI.callTestCase(findTestCase('Workflows/User Search'), [
    ('firstname') : findTestData('RandomPerson').getValue(2, 1),
    ('lastname') : findTestData('RandomPerson').getValue(3, 1), ('usertype') : 'Test'

How do I pull multiple columns into different variable from the same findTestData call?

Please use “Code Formatting” syntax in your next post to render your code more readable.

1 Like
import com.kms.katalon.core.testdata.TestData

TestData result = findTestData(‘RandomPerson’)

    findTestCase(‘Workflows/User Search’),
        ('firstname') : result.getValue(2, 1),
        ('lastname') : result.getValue(3, 1),
        ('usertype') : 'Test'
1 Like