Ask a Question

How to use boolean to check that element is empty in Conditional Goto

SOLVED
tclotworthy
Contributor

How to use boolean to check that element is empty in Conditional Goto

Hello,

I successfully use boolean to check for not empty condition (see screenshot), but its the opposite that I want to do (i.e., go to CreatePID when value is empty. How do I change to xpath to accomplish this? Thanks for any reply!

Screen Shot 2016-01-21 at 5.12.34 PM.png

1 ACCEPTED SOLUTION

Accepted Solutions
tclotworthy
Contributor

Re: How to use boolean to check that element is empty in Conditional Goto

Hi, I have made progress with this problem, but still have not resolved it. I found that using the following conditional xpath expression achieves the result I want: 

 

 not(//planId[1])

 

However, when I run the test suite, it does not behave as I would expect. In fact here is the output when the conditional goto step (CheckUpdatePID) matches case. In the following output from TestStepResults, Step 478 correctly recognizes to transfer to UpdatePID, but the next step executing is XferPlanIdUpdatePIDtoGetPID, which results in an error.

 

Step 478 [CheckUpdatePID] OK: took 4 ms
-> Matched condition [UpdatePID], transferring to [UpdatePID]
CheckUpdatePID
Step 479 [XferPlanIdUpdatePIDtoGetPID] FAILED: took 1 ms
-> Error performing transfer [planId] - error: Unexpected element: CDATA
XferPlanIdUpdatePIDtoGetPID

 

Ok, so I think part of my problem is that I am misunderstanding what I can do with invoking steps from a Groovy script. I have a groovy script that executes a series of steps as follows (relevant lines in bold):

 

for( i in 1..50 )
{
testRunner.runTestStepByName("CreatePID")
testRunner.runTestStepByName("CheckCreatePID")
testRunner.runTestStepByName("XferPlanIdUpdatePIDToUpdatePIDComment")
testRunner.runTestStepByName("UpdatePIDComment")
testRunner.runTestStepByName("CheckUpdatePIDComment")
testRunner.runTestStepByName("XferPlanIdUpdatePIDCommentToUpdatePID")
testRunner.runTestStepByName("UpdatePID")
testRunner.runTestStepByName("CheckUpdatePID")
testRunner.runTestStepByName("XferPlanIdUpdatePIDtoGetPID")
testRunner.runTestStepByName("GetPID")
}

 

Is the fact that the test case executes from the script corresponding named steps are disabled from the groovy script overriding my intention — to go from CheckUpdatePID back to UpdatePID when the conditional goto match occurs? See screenshot below to see view of test case. Any help for how to get my conditional goto to work properly is greatly appeciated. Thanks!

 

Screen Shot 2016-01-24 at 3.20.47 PM.png

View solution in original post

3 REPLIES 3
nmrao
Community Hero

Re: How to use boolean to check that element is empty in Conditional Goto

Do you still have this problem? I see your post related to this got answered here
http://stackoverflow.com/questions/34935643/how-to-use-xpath-boolean-to-check-that-element-is-empty-...


Regards,
Rao.
tclotworthy
Contributor

Re: How to use boolean to check that element is empty in Conditional Goto

Hi, I have made progress with this problem, but still have not resolved it. I found that using the following conditional xpath expression achieves the result I want: 

 

 not(//planId[1])

 

However, when I run the test suite, it does not behave as I would expect. In fact here is the output when the conditional goto step (CheckUpdatePID) matches case. In the following output from TestStepResults, Step 478 correctly recognizes to transfer to UpdatePID, but the next step executing is XferPlanIdUpdatePIDtoGetPID, which results in an error.

 

Step 478 [CheckUpdatePID] OK: took 4 ms
-> Matched condition [UpdatePID], transferring to [UpdatePID]
CheckUpdatePID
Step 479 [XferPlanIdUpdatePIDtoGetPID] FAILED: took 1 ms
-> Error performing transfer [planId] - error: Unexpected element: CDATA
XferPlanIdUpdatePIDtoGetPID

 

Ok, so I think part of my problem is that I am misunderstanding what I can do with invoking steps from a Groovy script. I have a groovy script that executes a series of steps as follows (relevant lines in bold):

 

for( i in 1..50 )
{
testRunner.runTestStepByName("CreatePID")
testRunner.runTestStepByName("CheckCreatePID")
testRunner.runTestStepByName("XferPlanIdUpdatePIDToUpdatePIDComment")
testRunner.runTestStepByName("UpdatePIDComment")
testRunner.runTestStepByName("CheckUpdatePIDComment")
testRunner.runTestStepByName("XferPlanIdUpdatePIDCommentToUpdatePID")
testRunner.runTestStepByName("UpdatePID")
testRunner.runTestStepByName("CheckUpdatePID")
testRunner.runTestStepByName("XferPlanIdUpdatePIDtoGetPID")
testRunner.runTestStepByName("GetPID")
}

 

Is the fact that the test case executes from the script corresponding named steps are disabled from the groovy script overriding my intention — to go from CheckUpdatePID back to UpdatePID when the conditional goto match occurs? See screenshot below to see view of test case. Any help for how to get my conditional goto to work properly is greatly appeciated. Thanks!

 

Screen Shot 2016-01-24 at 3.20.47 PM.png

View solution in original post

tclotworthy
Contributor

Re: How to use boolean to check that element is empty in Conditional Goto

Let me apologize. I should not have been using this message to address what is essentially a new/different problem from the original intention of the message when it was created. I am saying this is solved, and have opened a new message topic to address my current problem.

cancel
Showing results for 
Search instead for 
Did you mean: