Forum Discussion

tclotworthy's avatar
tclotworthy
Contributor
9 years ago
Solved

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 ac...
  • tclotworthy's avatar
    tclotworthy
    9 years ago

    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