Logging a value on a webpage

Hi,
I was wondering if there is a way to log say a line of text, that changes from test to test due to it being a reference number, on a successful test or preferably as part of a report. It would be super useful to me if i could run a test and then be able to turn around and say i ran 10 tests here are the references as logged by my test.

thanks in advance

@stan.sole Yes it is possible. You just need to grab that text and save it in a variable then print it. This way it will be in a report. You can have your reports saved to Katalon Analytics too.

Another way is to save the variable into a database this way you can reference which text was saved at what time.

I use both the approaches at my workplace. We regularly do clean up of our test environments and then using Katalon Studio I generate test data for specific requirements and scenarios. This is all published in form of reports in Katalon Analytics and from there different teams can find out what scenario can be accomplished with what test data.

1 Like

Thanks a lot

Hi, I’m a newbie in Katalon.
Can you give me sample script for this.
Or even manual script much better. Thanks a lot

attribute = WebUI.getText(findTestObject('your test object goes here'))
println(attribute)

if you wish to reduce the amount youre capturing i.e.
“your reference is abc123”
but you only want the actual reference see this thread:

// Get text of Register link
result = WebUI.getText(findTestObject(‘link_Register’))

println +result

Hi, thanks for the script. I tried this suggested script on my testing. It will return passed on my testing but the case number that I try to capture for reference is not save on my testing. Here’s the result. thanks for the help.

01-29-2020 05:25:44 PM attribute = getText(findTestObject(“Object Repository/Page_SRF/case-number”))

Elapsed time: 0.832s

Text of object ‘Object Repository/Page_SRF/case-number’ is: ‘’

Still can I used my object repository even CSS?
Or should I need to provide the Attributes? Since Attributes is the script calling. Many thanks!

Where are you looking for the text? It should appear in the report once it has been printed. I believe the println command is required for this, are you using it? I am not so sure what youre asking with the second comment, as long as it has a valid object repository i see no reason as to why it wouldnt work.