TestProject Forum

Output results from sub-test only set if sub-test passes

I have a subtest, ‘At Location’. This test gets the current URL, then has another check to see if the URL contains a substring e.g. /Administration/. If it does, it saves the value to an atLocation parameter. I have set the test to “Always pass” so that, even if the URL does not contain that value, it (should) still saves the value to the atLocation parameter.

In another test, I include the ‘At Location’ test. I pass in a value of ‘/Administration/’ to check where my location is currently. If I am in the “Administration” section of the site, the atLocation parameter gets set correctly. However, when I run from a section outside of the “Administration” section i.e. the sub-test would return a failure/false, the atLocation parameter of the sub-test is not set with a failure of Requested to set the value of sub-test output parameter "atLocation"to test parameter "atLocation", but "atLocation" is never set!

Is there something I am doing wrong, or is this a bug?

OK, I think I figured out a workaround (or maybe the way I should have been doing it?!?!?)

So in my “At Location” test, I kept it at “Always pass”.
In my “Parent” Test, I set the included “At Location” test to “Always Pass”. This way, if the test fails, it will continue to do the subsequent test steps.
In my subsequent tests in the “Parent Test”, I do a check for whether "atLocation Equal <empty string>"
This way, the “atLocation” parameter is either passes and sets a value or fails and does not set a value.