Forum Discussion

mcp111's avatar
mcp111
Contributor
6 years ago

Copy tests if they are similar

Can I copy one test to another if theyare similar and manually make few changes?

eg. In login test, I may have valid login/pwd as one test

In another, it may just be valid login and invalid password.

Instead of recording a whole new test, can I copy the first test and just make changes?

 

10 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    I would prefer creating a common function for login and call them in individual test.

    • mcp111's avatar
      mcp111
      Contributor

      You didn't understand

      There are two tests, one is a successful login and another is unsuccessful.

      Since the only difference is the password, I want to copy the first and create the second test.

      Is there a way to do that?

       


      shankar_r wrote:

      I would prefer creating a common function for login and call them in individual test.


       

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        shankar_r is right.  You could have a common login function and then call it once with successful data and once with unsuccessful data.

         

        But can you copy one test to another?  Sure.  Select all the code in the one you have and copy it.  Add a new blank test and paste.  Done.

         

        You can also make a copy of the test file in the TC directory with a new name, then in the Project you can use the Add Existing feature to add that renamed test into the list.