Ask a Question

Structure of Test Script

nimishbhuta
Frequent Contributor

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 5
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.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
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?

 

 

 

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.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
cancel
Showing results for 
Search instead for 
Did you mean: