Forum Discussion

nimishbhuta's avatar
nimishbhuta
Frequent Contributor
7 years ago

Structure of Test Script

Hello, 

 

I want to know what is the best way to structure the automated test script.I am listing different approach to structure the test scripts

 

For ex: if I have a test that contains Login, Action1,Action2 and Logout

 

1) Test Script Structure Approach using Keyword Test:- 

 

 Create one Keyword test for Login, Action1,Action2 and Logout. Once you do that you create a project item and then create child item as Login,Action1,Action2 and Logout. 

 

2)  Test Script Structure Approach using Script and Keyword Test :- 

       

 Create one Script for Login, Action1,Action2 and Logout. After than create one Keyword Test and call all this 4 script Once you do that,create a project item with the keyword test. 

 

3) Test Script Structure Approach using Script 

      Create one Script for Login, Action1,Action2 and Logout.After create one Main Script to call all the 4 script. Once you are done then create a project item with Main Script. 

 

Please let me know from the above which is the best way and the reason behind it. If you have any another way which is not listed then mention it and also reason behind using it. 

 

Nimish

             

    

       

 

 

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The answer is... It depends.

     

    What are you hoping to accomplish? What's your long term plans for multiple test cases in your project? What is your strategy for exception handling and reporting of errors in your automation code?

     

    Personally, I lean more towards point 3.  That makes the test item the "test case".  It allows you to "fail" a test case and still proceed on to the next one.  It's closer to what we do in our framework we use in my employment.

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      It also depends on who is going to be running and maintaining the tests.  Keyword tests are good for those who aren't familiar with coding or if they are just learning. 

       

      I found the "Convert to script" function very useful for training.  Once someone is comfortable with keyword tests, you can use the convert function to show them what the same test is in script and it's a good bridge to learning the code.

  • cunderw's avatar
    cunderw
    Community Hero

    There really is no "Best Way", as it depends on your needs and the application. That being said my approach that I have found works really well is very similar to " Create one Script for Login, Action1,Action2 and Logout. After than create one Keyword Test and call all this 4 script Once you do that,create a project item with the keyword test. "

     

    I use a library of script units for Actions, Connections, Data, Utilities, Verifications, etc...

     

    These are all shared by add existing item in all projects, then we use either KWTs or other scripts to call these with desired parameters, adding the KWT or script as a project test item.

    • nimishbhuta's avatar
      nimishbhuta
      Frequent Contributor

      Thanks for your reply. 

       

      "These are all shared by add existing item in all projects, then we use either KWTs or other scripts to call these with desired parameters, adding the KWT or script as a project test item"

       

      Can you elaborate on this further?

       

      I would like to know the folder structure for your framework and how are you handling the input of one action, which becomes the output of another.

       

      Are you handling inside the excel sheet or using parameter of the test? if you are using the parameter of he test then let me know how exactly are you doing it.

       

      How about managing your test results? Are you using the standard test results of TestComplete or customized one?

       

       

       

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Sounds like you are starting from the very beginning.  Lots of good information here:

        https://smartbear.com/learn/software-testing/

         

        We can give you our examples but none of us are testing exactly the same thing as anyone else so it is best if you come up with something for your product and try it.  Just do a small sample layout in TestComplete and see if it makes sense.  If not, you can always delete the project and start over.