package file;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.SeleniumServer;
public class Reset extends SeleneseTestCase {
private SeleniumServer seleniumServer;
private Selenium selenium = new DefaultSelenium( "localhost",4444,
"*chrome","http://");
public void setUp() throws Exception
{
seleniumServer = new SeleniumServer();
seleniumServer.start();
selenium.start();
}
//Test methods shd go here
public void tearDown()throws Exception
{
selenium.stop();
seleniumServer.stop();
}
}
create new project->enter project name->next->libraries->add selenium server.jar and junit-4.8.2.jar and click finish.
Way to export the java program to eclipse IDE.
1)After recording test case,click on options->format->Junit 3
2)Copy the method and paste it in between setup and teardown method.
3)Run->run as Junit
You can see your test case running...Enjoy!!!
What about using TestNG?
ReplyDeleteHow is this code could became in TestNG?
please check my other post containing the code for testNG
ReplyDeleteHi,
ReplyDeleteIf i have 30 testcases, How can i run server only onces and stop after all testcases passes?
Thanks
Azhar