How to print/comment an integer value in report

I have a string like this:
Account 0000011181 created.

I need to split this string and print/comment integer value:0000011181 in report like below:
Account# is 0000011181.
Please advise.

NB: I stored the characters in string array and was able to split them to retrieve 0000011181 bt when i try to use println or comment-0000011181 fails to print/show as comment in report.

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

Hi @dsingh1 ,

Do you receive any error when trying to print it? Or it just did not show the result?

error trace please

def acctNumber = "Account 0000011181"

def routeNumber = acctNumber.split(" ")[1]

WebUI.comment("Here is your ${routeNumber}")

image

Nothing prints with system.out.println

Can you try @grylion54 suggestion?

You could try the LogInfo of class KeywordUtil to print out your value in Report:
int a = 123
KeywordUtil.logInfo("my var = " + a)

2 Likes

When you use “WebUI.comment”, you will find the results displayed in the Log Viewer tab.
When you use “KeywordUtil.logInfo”, you will find the results displayed in the Log Viewer tab.

When you use “println”, you will find the results displayed in the Console tab (the tab next to the Log Viewer tab, see image above).
Note: You will find your displayed results easier if you add some known text to your variable, like below:
println("Here is your " + PolicyNumber)
or
println("Here is your ${PolicyNumber}")

3 Likes

Hi there @dsingh1, :wave:

Just checking in to see if you have tried any of the suggestions and workarounds proposed by other members in this thread yet.

Please remember to follow up with others regularly to get the best support from our forum.

Thanks,
Albert

1 Like

Thanks for checking @albert.vu.
@grylion54 suggestion worked for me.

1 Like

Thanks @grylion54.Your suggestion worked for me.

1 Like