How can I compare data in object text and test data

I want to compare the accuracy of the data in the test data with the data I enter into objects.

hi,
could you give some example what you will do?

1 Like

You might need to supply some more info but keyword ‘Verify Match’ sounds like a good start eg compare text returned from your TO with a string, or preferably a Test Data Value.
eg:
objectTextVariable = WebUI.getText(findTestObject(‘your test object’))
WebUI.verifyMatch(objectTextVariable, ‘textToCompare’, false)

or check keyword ‘Verify Equal’

2 Likes

I use Excel via COM (see previous link I posted) and have done for years. Used it that way in QTPro and use it in a very similar way with TC. I’d say read up on the Excel handling in the previous link and see if you can at least get it to return you the data in the format you want. I also do everything with 100% script. Not familiart with the KeyWord side of TC.

No idea about extracing info from Qlikview report as I’m not familiar with it’s structure.

Admin

1 Like

or
you can use asserts as well

1 Like

I will try this. Thank you very much

I have a test data. I want to compare the accuracy of the values ​​I enter here with the text fields.
I tried with verify equel but I can’t get the contents of the objects.
I want to do it without using a variable

1 Like

hi,

supply error what your are faced
and piece of html & script would be nice to see

1 Like

Not sure if you mean something like the below. I set a date (it’s just a String at this time), and then check if the date is the contents of the input field. I use verifyMatch for Strings and verifyEqual for Numbers and Objects.
WebUI.setText(findTestObject(‘My Page/input_SDMDetails.DateSDM’),
GlobalVariable.gFormattedYesterdayDate)

WebUI.sendKeys(findTestObject(‘My Page/input_SDMDetails.DateSDM’),
Keys.chord(Keys.TAB))

WebUI.verifyMatch(WebUI.getAttribute(findTestObject(‘My Page/input_SDMDetails.DateSDM’),
‘value’), GlobalVariable.gFormattedYesterdayDate, false)

You could also just print out your data to the console and see what it is/was. Just as easy to put two inputs attributes to compare. One benefit of verifyMatch is it prints out BOTH strings within the report so you can verify what you have/had.

verifyMatch: Actual text ‘04/22/2020’ and expected text ‘04/22/2020’ are matched

1 Like

hello,

def first = “04/22/2020”
def second = “04/22/2020”

print(WebUI.verifyMatch(first, second, false))
true
WebUI.verifyMatch return true or false (boolean value)

1 Like

hello,
not sure is this what you will

import com.kms.katalon.core.util.KeywordUtil
    KeywordUtil log = new KeywordUtil()

    def first = "04/22/2020"
    def second = "04/22/2020"

    print(WebUI.verifyMatch(first, second, false))

    log.logInfo("this is info step")
    log.markFailed("this step is failed")
    log.markError("step has error")

    log.logInfo("DEBUG first variable to verify: "+first)
    log.logInfo("DEBUG second variable to verify: "+second)

    print(WebUI.verifyMatch(first, second, false))
1 Like

hi sametkurt, have you found the solution for your issue? because I have the same issue now. I cant get the value of the Test Object, katalon read my test object as string. Here’s the message. Please help.

Test Cases/Input_Pengajuan FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Actual object ‘TestObject - ‘Object Repository/Page_External Agent - Form Pengajuan OTOKr_718cc9/input_Harga Pasar (Market Price)_dataExagotr’’ and expected object ‘602000000’ are not equal