Test Automation Scripts Example Structure

Test Automation Scripts

A test is considered as a single action or a sequence of actions, that defines whether a specific feature meets functional requirements.

It has multiple test files / packages / class files which will be executed based on the configurations defined in testng.xml.


Test Sample for Valid Data:-

test script for valid data

Test Sample for Invalid Data:-

test script for invalid data

Why and How to Automation Test Scripts:

The actual task and the important task starts from here.

From here the user need to have the logical thinking and write a complex programs/test scripts which will get executed.

Here a Questions arises when people think of automation. How much percentage of programming knowledge needed to become Automation Analyst?

I can simply say “The More You Know The More You PLAY”

If the person is really strong in programming and logical thinking, he/she can simply play with any automation tool.

We should be able to tell the tool to execute the test cases in a very simple way and that code should be easily understandable to other users who look into it.

In Above example “Add Users With Valid Data”

To execute the test case, we need to login to the application. We also need to check if the user is already logged in or not. And the other we need to check is if the logged in person is having access to “Add Users” or Not. If the above Two Conditions are passed then we should execute the rest Else we should return the test as failed.




You made some really good points there. I looked on the web for more information about the issue and found most people will
go along with your views on this web site.

good good good good good

Thanks a lot.
For navigating through span tag selenium

In this case, it runs 1st test case with login and then runs 2nd test case again with login which will fail, as the User is already logged in.
There are 3 ways:
1. It should log out of the application after each test case
2. It should use new browser instance for each test case

Above 2 options are time consuming.
3. Use @BeforeClass or @BeforeMethod annotation of TestNG

I want to know, what is the best practice?


Hello Sir/Mam,
Anyone please guide me which course should i go to glow n future.since im a fresher i dont have any basic idea of prefering which course.i have learned the manual testing to be automated more and explore i need to know which course should have prefer pls ley me know with valid details please i have decided to go in testing field


explains how the framework is developed

Add new comment