ATF - reuseable tests - use within other reusable tests (can I?)

catho
Tera Expert

I am recreating some of my ATFs that have a lot of steps, and trying to create a lot of reusable tests, so that I am reducing common steps, but can also have better instructions on each test and what it does.

 

I have created my first reusable test, which creates a number of users, including an admin, as well as users of a specific module. I am doing it as create user, not insert record, so I can add them to groups and roles in the same step. I am not impersonating any of them in this reusable test.

 

In the second reusable test I am creating, as the first step, I am calling reusable test #1 (user creation), and then I want to impersonate one of the created users as a test step.

 

The user field is a reference one, and the users I am creating do not exist yet, and it will not let me enter the name without linking to a user, and I cannot use the pills to refer back to the first test.

 

It doesn't make sense that late in a reuseable test I try and recreate users that will have already been created, or create a second admin account.

 

Does anyone have any suggestions on this?

 

#atf #reusabletest #test

1 ACCEPTED SOLUTION

catho
Tera Expert

 

Ok - I think I can do this - I was missing a step.

 

When I create the tests - apart from defining the test steps, I should also be defining reusable output variables - this video is a good explanation: https://www.servicenow.com/community/developer-forum/reusable-test/m-p/3303517

View solution in original post

2 REPLIES 2

catho
Tera Expert

 

Ok - I think I can do this - I was missing a step.

 

When I create the tests - apart from defining the test steps, I should also be defining reusable output variables - this video is a good explanation: https://www.servicenow.com/community/developer-forum/reusable-test/m-p/3303517

catho
Tera Expert

Actually .... that doesnt work. 

If my steps are:
1. Reusable test 1 (create users INC admin)
2. Other test steps related to module

3. Reusable test 2 (impersonate admin then run several scheduled jobs)

Even using output variables on the first reusable test, I cant refer to those in the second reusable test ....... any suggestions?