ATF Parametrized Testing - How to Get Test Parameter Values from ATF Server Script

dougconnell
Kilo Guru

I am using an ATF Server Script to test a Script Include that I developed.  My  new step is the first step in my Test.   I would like to use Parameterized testing and include one of the Parameters as an argument for testing one of the methods in my Script Include,  How do I retrieve a Parameter value from inside the script?

The comments in the template of the Server Side Script mentions jasmine and functions such as:  

  1. steps(PREVIOUS_STEP_SYS_ID).<variable name>
  2. assertEqual()
  3. stepResult.setOutputMessage("");
  4. outputs.<variable name>

I guess, I was expecting a method such as:

  1. parameters.getValue("variable_name")

 

 

1 ACCEPTED SOLUTION

Luke Van Epen
Tera Guru

Server tests are not supported unfortunately, from their docs page:

find_real_file.png
 
https://docs.servicenow.com/bundle/madrid-application-development/page/administer/auto-test-framework/concept/parameterized-tests.html
 

View solution in original post

3 REPLIES 3

Luke Van Epen
Tera Guru

Server tests are not supported unfortunately, from their docs page:

find_real_file.png
 
https://docs.servicenow.com/bundle/madrid-application-development/page/administer/auto-test-framework/concept/parameterized-tests.html
 

Alberto Roma_ac
Kilo Contributor

Here's an alternate solution:

1. Record Insert  (for example, an Incident)

    • Store a parameter in the description field

2. Server-Side Script

    • Retrieve the record inserted and use the description field as the parameter
// In server-side script
//*************************
var createBufferIncident = 'a1...d7'; // sysid of previous Record Insert step
var bufferIncident = new GlideRecord('incident');
bufferIncident.get(steps(createBufferIncident).record_id);

// Use bufferIncident.description to access the stored parameter
gs.info(bufferIncident.description);

 

Hope this helps!

Alberto

Michele22
Tera Contributor

Oh, what a pity.
This limit seems still valid on Tokyo release.
There is a workaround to run a test on a function in a server include with a set of different parameters? Or I have to create a test step for each different param that I want to test?