I need to write and execute some test scripts and provide evidence on a short time-frame. The basic scenario revolves around creating work requests in one system, and approving or rejecting them in another system. Each individual test begins with the creation of a work request, so I have a unit test for that. Rather than copy those into my other tests (since if I change the test for creating a work request I now have to change all of them) I'm just making my first step "Create a work request as in scenario 1".

What are the pros and cons of this approach? Is this considered a best practice? Is there a better alternative to this approach (other than... not allowing this to get into a time crunch where I have to skimp on the quality of my test scripts... obviously...)

1 Answer 1


My general rule of thumb is the same if you are automating or running/writing the tests manually.

If a dependent class/script changed would your tests fail as a result

If the answer is yes, its not appropriate to reference the script. If the answer is no, then it may well be fine.

For example.

Script 1 (login success)

  1. Go to login page www.12345.com/login
  2. Enter Username "admin"
  3. Enter Password "password"

Script 2 (click button)

  1. Run "Script 1 (login success)"
  2. Click button

In this example, if I were to update "Script 1" with new valid login credentials then "Script 2" would remain unchanged. That would make it an appropriate candidate to be referenced.

Other potential questions to ask when considering referencing other test steps;

  • Is the referenced step always required? For example, if i login in a previous test then will you still be able to follow the test steps?
  • Does referencing a script add additional complexity? Referencing one consistent test can be viable but if you separate out 4 or 5 then it can become very complicated to follow
  • Does referencing a script save time in execution? If you only need to login in 2 out of 100 tests, then referencing the other scenario might actually take longer than following it in a linear manner.
  • I like that logic. Are there any other questions I should be asking for if this is appropriate?
    – corsiKa
    Commented Nov 20, 2015 at 16:15
  • YES ! you should ask "Are there any other questions I should be asking for if this is appropriate?" it's good to ask from other's experience but try to bring some of you rown
    – Rsf
    Commented Nov 23, 2015 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.