1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

By Arun Motoori

Lets write the Selenium Automation Code without Refactoring it.Lets make sure that our code contains more than one tests.Lets include TestNG annotations in our code and later Run using ‘TestNG’.Test Description:
Implement this on Eclipse IDE using TestNG framework:Pre-requisites:1. Create a new Project say ‘RC-Project66’ in Eclipse IDE2. Configure the Project to work with Selenium RC3. Configure the Selenium Standalone Server to run from Eclipse IDE4. Start the Selenium Standalone Server5. Create a package say ‘package66’ under the newly created project.6. Create a Java Class file say ‘Class66’ under the newly created package as shown below:
Actual Steps:1. Write the following code into the newly created Java Class file as shown below and make sure that you resolve all the errors before going to next step: (Write three tests inside a single test method)
2. Start the Selenium Standalone Server3. Save and Run the ‘’ file by selecting the ‘TestNG’ option as shown below:
4. Ensure that all the three tests in our Automation code are passed as shown in the below video:Watch the below video:Click here to watch the video.Download this Project:
Click here to download this project and import into Eclipse IDE on your machine.Is it ok to write three tests in a single Test method instead of writing them in separate test methods?

The answer is No. Though the Test runs without any errors even if we mention more than one tests in a single test method, its not a good practice to write more than one test into a single test method.

So what we have to do in order to overcome this ?

We’ve to write each and every test into a separate test method.

Please comment below to feedback or ask questions.

Only one test should be written inside a single test method will be explained in the next post.


Category: aafx. 154. Non-Refactored Selenium Automation Code using TestNG framework

Você também pode querer ler

Comments are off for this post.