What is the best approach to develop a test script in selenium webdriver?

I am a beginner in Selenium and I have started preparing test scripts in selenium webdriver. My concern is What would be the best approach/framework to automate tests. I have written in 3 ways:
1. Prepared test scripts seperately.  ex. Login, Dealer, Dealer Group,User etc.
2. Reusable script ex. data driven framework using excel
3. TestNG framework, using xml
I am confused, please help me… :)

Aruna Train Asked on March 2, 2015 in Selenium WebDriver.
Add Comment
4 Answer(s)

Hi Aruna,

The best approach is using TestNG framework. Here, you can split the scripts into blocks and you can easily identify where the errors are occuring. So, use TestNG framework.

Regards,
Vaidy

Vaidy Doctor Answered on March 3, 2015.
Add Comment

Hi Vaidy,

Thank you so much. I will continue using TestNG framework.
Here I have one more question:
When I use XML, @Beforemethod is running frequently, I mean i have classname1.method1 and classname2.method2 my test is executing @before while running  classname1.method1 and executing again while running classname2.method2
How should I overcome this?

Regards,
Aruna

Aruna Train Answered on March 3, 2015.
Add Comment

Hi Aruna,

Kindly share the code. I will execute it and tell you the answer.

Regards,
Vaidy

Vaidy Doctor Answered on March 3, 2015.

Thanks  Vaidy,

When I run this xml , 2 browsers are opening and it is executing only login. not executing dealers class

Check my xml code

<?xml version=”1.0″ encoding=”UTF-8″?>
<suite name=”Telemetry Project”>
<test name=”Telemetry”>
<classes>
<class name=”Telemetry.Login_TestNG”>
<methods>
<include name=”Admin()”/>
</methods>
</class>
</classes>
</test>
<test name=”Dealers”>
<classes>
<class name=”Telemetry.Dealers_TestNG”>
<methods>
<include name=”CreateDealer()”/>
</methods>
</class>
</classes>
</test>
</suite>

Regards,
Aruna

on March 3, 2015.
Add Comment

Best approach is TestNG framework , xml

Regards,
Aruna

Aruna Train Answered on March 12, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.