Tests depending upon other tests is a major code smell!
Hi All,
class testclass1{
--
You received this message because you are subscribed to the Google Groups
"webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to
webdriver+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/webdriver?hl=en.
It sounds like you need a login functions that you can call in your tests.
Hi Elangovan,
Login is not a test its an operation on the page. So make login a method in the Loginpage class and you will have to call this operation from any other testclass. This is the basic principle behind Page Object Pattern.
Also, in your code you are trying to create an object for a method - ideally you should be instantiating the class and not the method.
Thanks, Karthik

WebDriver driver = null;
By usernameInput = By.cssSelector("input#Email");
By passwordInput = By.cssSelector("input#Passwd");
By signInButton = By.cssSelector("input#signIn");
public LoginPage(WebDriver driver) {
this.driver = driver;
}
public void login(String username, String password) {
driver.findElement(usernameInput).sendKeys(username);
driver.findElement(passwordInput).sendKeys(password);
driver .findElement(signInButton).click();
}
@Test
public void testLoggingIn() {
LoginPage login = new LoginPage(driver);
LoggedInPage main = new LoggedInPage(driver);
login.login("dar...@gmail.com", "not my real password");
assertTrue(main.isLoggedIn());
}
@Test
public void testMessageCount() {
int expectedNewMessages = 3;
LoginPage login = new LoginPage(driver);
LoggedInPage main = new LoggedInPage(driver);
login.login("dar...@gmail.com", "not my real password");
int actualNewMessages = main.getNewMessageCount();
assertEquals(expectedNewMessages, actualNewMessages);
}
setUpa few lines of code to get a resultan assert statement to confirm you got the result you expectedtearDown.