Bulk Upload of Test Cases into ServiceNow's Test Management 2.0

Parul Kaushik
Tera Contributor

Hello,

We have Test Cases created in standard excel format which we would like to upload into Test Management 2.0.

Does anyone have any experience or even documentation(or article links) specifying the step-by-step process of doing so using ServiceNow's Import/Export functionality?

We are trying to determine the type of template, consisting columns, their data types, main ServiceNow tables that are needed to be considered for importing our excel Test Cases in bulk into TM 2.0.

 

Thanks,

Parul

 

 

3 REPLIES 3

Khanna Ji
Tera Guru

I have a similar question. Did you achieve it?

phil bool
Tera Contributor

The only way I've achieved this was by using server-side script.  For example, I've done this from a business rule, where we created a copy of a standard test and associated it to a record.
You could do this if you can break the test steps down into individual strings.  

Put all those strings into an array at the top of a Fix Script, then you could use GlideRecords to create the test and the test version, then loop through the values in the script and use a GlideRecord to create each test step sn_test_management_step in the test version record.  Remember to set the test_version value to be your version, and to set 'needs_verification' on at least one of your test steps, otherwise the test won't run. 
Once that's finished, set the Version's state to 'ready', and the test should be ready for use.

If you're handling this in bulk, you may want to create an import set to hold your 'test step' records in temporarily so you can reach them from on the platform, rather than having to convert the test steps into an array in excel before you start. 

Adam43
Tera Contributor

Hi Parul-

Curious of any progress on this.  I've been playing with doing this via catalog item to allow our ATF team to upload their excel-developed test steps into TM 2.0 with the info here https://www.servicenow.com/community/developer-blog/automate-data-import-from-excel-file-attachment-....

I've discovered that the steps are related to the tests via the test-version (at least in Tokyo)- so for the field map- I believe I need to get the sysid of the particular version of the test a step should relate to.

 

I've been playing with a data source and 2 transforms- one to create the tests and one to create the steps.  But I can't seem to get the scripted field map right to lookup that sysid for the version record so the step is related to the version/test.  The transform always reports it as invalid or undefined object.  any thoughts?

I'm trying the following script, and the target field for this script is the 'version' on the step record.  I'm also setting 'short_description' as the referenced value field name, as that's the field on the test record that's getting looked up in the reference field queried during this script.

 

answer = (function transformEntry(source) {

    var testver = new GlideRecord('sn_test_management_test_version'); //query test version table
    testver.addQuery('test',source.u_test_name); //pass test name via import set table
    testver.query();
    return testver.sys_id; // return the value to be put into the target field

})(source);
Adam43_0-1687984462625.png