Validate multiple values in an element

When I do a getText I get the value in the following format -
Apple
Oranges
Pears

Now I want to verify these values rendered are as expected.
I was thinking of comparing these values with values in an excel sheet. (so incase these values change I will have to change only in the excel sheet and not the code)

Not sure how to go about this.

Any pointers would be of great help to unblock me !!

I would do this as an Internal Test Data object. Give this a read on how to create it, as well as how to use it in Manual Mode:

https://docs.katalon.com/katalon-studio/docs/manage-test-data.html#create-an-internal-test-data

If you’re like me, and you use Script Mode, you can get/use this data like this:

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

TestData data = findTestData('path/to/my/data');
assert myText = data.getObjectValue(1, 1);
.
.
.
1 Like

Thanks Brandon. I am able to verify now using the Internal Test Data.

I have the following scenario -

Fruits = WebUI.getText(findTestObject(‘Object Repository/Page_Fruits /div_AppleOrangesPear’))
println(Fruits)

The print renders output in the following format
Apple
Oranges
Pears

I now want to assert the values in the output.
If I have the test data file with the above output how do I compare it with the output values?

Thanks

How do I store the output of getText so I can compare it with the test data file?

I finally was able to compare the output of the webelement with the test data file. I just put the 1 row and 1 colmn in test data with
Apple
Oranges
Pears

But how can I compare Oranges from the output of the web element with the test data ? Since the output is just a list of string values

Hi,

List<String> list = new ArrayList<String>();
list.add("abc");
list.add("xyz");
list.contains("abc"); // true
list.contains("foo"); // false