A couple of default methods(getters and setters) are available for managing Parameter Test Data in Custom Function code:

1. setTestDataParameterValue(name,value)

2. getTestDataParamterValue(name)

Here's a sample Custom Function code that uses these methods to simply store and get Parameter Test data and nothing else:

import org.openqa.selenium.WebDriver;

import com.testsigma.customfunc.common.CustomTestStep;
import com.testsigma.customfunc.common.TestsigmaCustomFunctions;
import com.testsigma.customfunc.result.ResultConstants;
import com.testsigma.customfunc.result.TestStepResult;
import com.testsigma.testengine.exceptions.TestEngineException;

public class ParameterTestDataManager extends TestsigmaCustomFunctions{

  public TestStepResult storeParameterTestData(String name, String value) throws TestEngineException{
    TestStepResult result= new TestStepResult();
    result.setMessage("Parameter Testdata variable "+name+" with value "+value+" has been stored successfully");
    return result;
  public TestStepResult getParameterTestData(String name) throws TestEngineException{

    String testdata = getTestDataParamterValue(name);
    TestStepResult result= new TestStepResult();
    result.setMessage("The fetched Parameter Testdata variable "+name+" has value: "+testdata);
    return result;

In the above code, the user defined methods setTestDataParameterValue() and getTestDataParamterValue() allows us to store and fetch Parameter Test Data in our Custom Function. We just need to extend the 'TestsigmaCustomFunctions' class on the Custom Function class i.e ParameterTestDataManager for that.

Steps to get and set Parameter test data in your custom function

1. Extend your Custom Function code class from the class TestsigmaCustomFunctions

2. Use the method setTestDataParameterValue(String name, String value) to set Parameter Test Data

setTestDataParameterValue(name, value)

2. Use the method getTestDataParamterValue(String name) to get the previously stored Parameter Test Data

String testdata = getTestDataParamterValue(String name);

Note: You can use any variable name instead of 'testdata' to store the data.

Points to Remember

1. The most important thing that you need to note is that the setTestDataParameterValue() method will update the value in Test Data Profile that is selected in the Test Case Details and the update will happen only after the execution is complete. If you need to use it during the same Test, store it to Runtime Test Data as well for usage within the same test.

2. The scope of Parameter Test Data variable is permanent. Once changed, it will be persistent until modified later.

3. Please make sure the variable names are not duplicated. This might lead to undesirable results.