Parameters and Subtest: paramater is never set

Trying to run a subtest returns me this error that I dont understand:

Requested to set the value of sub-test output parameter "variableFee"to test parameter “variableFee”, but “variableFee” is never set!

This are the current details in the main script:

The parameters as defined in the main script:

Steps in my sub testscript:

One of the related step:

The parameters in the sub testscript

While the steps is part of an larger script, what this particular sub testscript is doing is essentially clicking on a checkbox, which enables a textbox (it is initially disabled), then a value is inputted in.

Firstly, I get the current value of the checkbox; determining whether it’s already checked(true) or not(null). This is outputted to variableFee

In my datasource, a field(setVariableFee) is determined whether the checkbox gets clicked, passing in “y” or “n” . Because checkboxes, as far as I know, only understand the values of “true” and “null”/blank, I add 2 more steps to convert the data parsed in from the data source and reset it to “true” and “blank”.

Basically, in coding terms:

if (setVariableFee==“y”) setVariableFee = “true”
else if(setVariableFee==“n”) setVariableFee = “”

I then compare setVariableFee vs variableFee and, depending on the output, will either click or not click the checkbox.

After that, I shall insert the value (variableFeeAmount) into the enabled textbox.

None of the 3 params are used in the main script.

Running this script from the main test returns the error. Running in from within the script works as expected.

Hi @erik.yeow.

When you run the main script in the recorder mode is it working?

I would like to suggest a different way to achieve the same. It should work, but feel free to send us a message to support@testproject.io and we will schedule a meeting to troubleshoot it together.

The option I would like to suggest for checking a checkbox’s state and clicking on it only if it’s unchecked, you can create the following steps:

  • Hover the checkbox element, press double-shift on your keyboard to capture it, and use the “Get Attribute Value” action.

image

  • Set the AttributeName input field to “checked” which will indicate if the checkbox is checked or not. save the output value into a parameter (is_chceked) for further use.

(Notice: if the checkbox is checked, the “checked” attribute value will be “true” otherwise, the value will be an empty string)

image

  • Create a new step, that performs a “Click” action on that checkbox, add a condition to this step, the condition will validate the “is_checked” parameter value and will execute the “Click” step only if the “is_checked” parameter value is not empty.
  1. Click on the “Advanced Options”

image

  1. Scroll down to the “Conditions” section, set the parameter to “is_checked”, the condition to “Equals”, and leave the last field empty, so the condition will check whether the value is empty or not.

image

This way, the “Click” step will be executed only if the condition is met, otherwise, it will be skipped.
Using these two test steps, you can click on a checkbox only if it’s unchecked.

Let us know if you need any help.

No, it breaks from the main script, but when I run the each step individually within the subtest it works. (also, as explain later, when I run the individual steps within the main script, they’re working as expected)

Im assuming its one of my input/output settings, but Im not sure which one it is supposed to be. (what I usually do is the build the steps within the main script, run it till Im happy with it, then select the relevant steps as a subtest, setting all parameters as requested by TestProject, matching the paramater names.)

I built the script to be slightly versatile, so I check whether its checked or unchecked, as well as whether the data source expects it to be checked or unchecked, and click on the element depending on both factors.

So I actually have a similar condition set.(not shown due to small monitor size)

The condition is in step 4.