How to reuse(extend) Test Case w/ATF

Dsm1
Giga Contributor

I am using Kingston and wanted to use ATF to run some tests.

An example is I create a new INC and expect a certain behavior.  I want to use this same INC to run additional tests for my processes, such as assignment group change, assigned to changes, etc. without having to create the steps multiple times for an INC.

How is this done because I cannot find it in the docs.servicenow site and want to be able to utilize this tool for my regression and enhancement testing?

Thank you.  Dave

7 REPLIES 7

Jeff Currier
ServiceNow Employee
ServiceNow Employee

You want to create an output variable in your first test which would be the incident number.  Then pass that to your other tests so you can open/operate on that incident.

This doc should help.

https://docs.servicenow.com/bundle/london-application-development/page/administer/auto-test-framework/task/atf-retrieve-value.html#atf-retrieve-value

So if I have 15 separate tests that use that variable I guess that they are all using the state of the variable the new test cases are running and that the new test cases would run independently of the other new test case record changes?

So if I change an Assignment Group in test case two based on variable of test case one I get a set of results for test case 2.

If I change the Assigned to of variable 1 in test case 3 it will execute against the Assignment group from variable record and not that of test case 2?

Sorry for extra questions, but want to make sure I understand how this feature works.

One more question...the link you referred me to specifies using a variable from a previous step.

It doesn't mention using a variable from a previous test case.

Can I use a variable from one test case to others?

Jeff Currier
ServiceNow Employee
ServiceNow Employee

OK, so you uncovered that I misread you initial question.  After each test execution, the data is reverted, so you cannot have a second test use the result of the first test as the data is gone.  So I jumped to the conclusion you meant test steps.

To accomplish what you want, you may want to look at templates.  You could create a template for create incident and then resuse that in your other tests so you don't have to re-create the steps for each test, just the additional steps.

Or you could create one big test with many steps to do more work on the same incident.