Quality Testing

Quality is delighting customers

Hi Guys,

I want to run multiple test methods in sequential order under the same class. Each method has it's separate login logout and some other functions. But when testng start second test method then it does not allow to login as it shows "User is already logged in" from the previous test method.
My aim is second test method should not start before completion of previous one.

So I want to set delay in testng while execution of multiple test method in sequential order.

Your reply will be appreciated.

Thanks
Gaurav

Views: 1968

Reply to This

Replies to This Discussion

Hi Gaurav,

Could you please provide some more information - 

Are you using any Test management tool for test execution?
The two tests you mentioned above are included in a single automation script?

Because - While you execute tests from Test management tools like Quality Center, Tool will execute tests one by one.

Why can't you use testng priority approch

@Test(priority=3)"

or

 dependOnMethods

@Test(dependsOnMethods = {method1" }) "

give the priority to annotations as mentioned below

--->

package automationFramework;

 
import org.openqa.selenium.WebDriver;
 
import org.testng.annotations.Test;
 
public class MultipleTest {
 
public WebDriver driver;
 
  @Test(priority = 0)
 
  public void One() {
 
      System.out.println("This is the Test Case number One");
 
  }
 
  @Test(priority = 1)
 
  public void Two() {
 
  System.out.println("This is the Test Case number Two");
 
  }
 
  @Test(priority = 2)
 
  public void Three() {
 
  System.out.println("This is the Test Case number Three");
 
  }
 
  @Test(priority = 3)
 
  public void Four() {
 
  System.out.println("This is the Test Case number Four");
 
  }
 
}
Console Output--->
This is the Test Case number One
This is the Test Case number Two
This is the Test Case number Three
This is the Test Case number Four
PASSED: One
PASSED: Two
PASSED: Three
PASSED: Four
try this it will help full 2 u
Keep Smile :-)

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service