Ziyaad
April 2, 2020, 1:43pm
1
Hello All, i hope everyone safe!
I have a concern and i will explain in details.
I have scan an object and that object will contain different values in different cases. See attached screenshot. My objective is that in next test case, another value will display however, the scan object will contain the previous value.
Can someone help me urgently?
Ziyaad:
See attached screenshot.
???
Please follow this advice:
My test is BROKEN! NOTHING WORKS! HELP ME!
Relax. We get it. We really do. There are some pretty smart and clever people on this forum, but you must realize, they are not magicians or wizards or gods. They cannot see your code, they can’t see your errors and they don’t even know what your AUT is meant to do even though it might seem perfectly obvious to you.
So please relax and follow the advice below, before you start writing your post. The advice below will tell you the exact information …
Ziyaad
April 2, 2020, 4:52pm
3
Hello, i just upload my screenshot
I’m not sure I understand…
Are you saying that td_Tom Hardy
might be td_Cillian Murphy
in the next test case?
Ziyaad
April 3, 2020, 5:19pm
6
yes but in the same xpath
Difficult to understand this.
I want to see some evidences. Could you try inserting some debug-print statements into your test and try running it twice.
WebUI.delay(3)
// insert this
WebUI.comment("var_checkName=" + var_checkName)
WebUI.comment("var_displayName=" + var_displayName)
if (var_checkName == var_displayName) {
log.logInfo("Passed")
} else {
log.logInfo("Failed");
}
What values of var_checkName and var_displaysName do you see? Do the values stay the same or move?
I guess, the var_checkName (which is retrieved from your internal test data) moves while the var_displayName (which is retrieved from the testobject) stays the same.
Ziyaad
April 5, 2020, 6:16pm
8
Yes, your assumption was right and today i prepare a small doc so that this can help you to understand better and provide me with a solution.KatalonIssue.zip (463.6 KB)
@Ziyaad
Thank you very much explaining your question. I understand your issue better.
Still, could you try inserting following debug-print statements and see what value the variables actually contain?
// insert this
WebUI.comment("var_checkName=[" + var_checkName + "]")
WebUI.comment("var_displayName=[" + var_displayName + "]")
I guess you may see the following output:
var_checkName=[Tom Hardy]
var_displayName=[
Tom Hardy
]
If this is the case, these 2 variables have different values: different number of leading/trailing white spaces. Therefore the test (var_checkName == var_displayName)
will be evaluated false.
So I guess, but we should check the fact first.
Ziyaad
April 6, 2020, 9:29am
10
Hello @kazurayam , i did the test and below the findings:
2020-04-06 13:23:14.657 DEBUG testcase.Basic LDAP auth for mono-user - 13: comment("var_checkName=" + var_checkName)
2020-04-06 13:23:14.663 INFO c.k.k.c.keyword.builtin.CommentKeyword - var_checkName=Tom Hardy
2020-04-06 13:23:14.663 DEBUG testcase.Basic LDAP auth for mono-user - 14: comment("var_displayName=" + var_displayName)
2020-04-06 13:23:14.664 INFO c.k.k.c.keyword.builtin.CommentKeyword - var_displayName=TestObject - 'Object Repository/scr_assertionConsumer/Page_Application Test/td_displayName'
2020-04-06 13:23:14.665 DEBUG testcase.Basic LDAP auth for mono-user - 15: if (var_checkName == var_displayName)
2020-04-06 13:23:14.665 DEBUG testcase.Basic LDAP auth for mono-user - 16: else
2020-04-06 13:23:14.666 DEBUG testcase.Basic LDAP auth for mono-user - 1: println("Failed")
Failed
This must be a surprise for you.
Now it is your turn, find out why the var_displayName got this unexpected value.
Ziyaad
April 6, 2020, 10:14am
12
I got this because i put this in a variable as show in screenshot.
First, you should remove the 4th line (var_displayName) you marked with red line.
In you test case script code, add a few lines like this, run it and see:
def tObj = findTestObject('src_assertionConsumer/Page_Application Test/td_displayName')
WebUI.waitForElementPresent(tObj, 10)
def var_diaplayName = WebUI.getText(tObj)
WebUI.comment("var_displayName=" + var_displayName)
if (var_displayName.contains(var_checkName)) {
...
}
1 Like
Ziyaad
April 6, 2020, 12:49pm
15
Thank you, it works now
However i did a small changes by removing “findTestObject”:
def tObj = (findTestObject(src_assertionConsumer/Page_Application Test/td_displayName))
Stay safe & stay home.