Reputation: 2819
Hi all I have written multiple test cases in selenium to perform following task using WebDriver
following is my selenium code to perform this task on my portal
Base Selenium Class
public class BaseSeleniumTest extends SeleneseTestBase {
protected static WebDriver driver;
@BeforeSuite
public static void firefoxSetUp() throws MalformedURLException {
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
@AfterSuite
public static void closeFirefox(){
driver.quit();
}
}//End BaseSeleniumTest Class.
Login Test Case
public class LogInTest extends BaseSeleniumTest {
LogInPage page;
public static final String BASE_URL = "http://www.mywebsite.com";
@BeforeMethod
public void beforeMethod() {
page = PageFactory.initElements(driver, LogInPage.class);
page.openPage(BASE_URL);
}
@Test(dataProvider="loginData",groups="loginGroup")
public void logIn(String email,String password) {
page.logInAs(email, password);
}
@DataProvider(name = "loginData")
public Object[][] getData() {
return new Object[][] { { "username", "password" } };
}
}//End of LogInTest Class.
Add Group Test Case
public class AddGroupTest extends BaseSeleniumTest {
AddGroupPage addGroupPage;
@BeforeMethod
public void openAddGroupPage() {
addGroupPage = PageFactory.initElements(driver, AddGroupPage.class);
addGroupPage.openPage();
}
@Test(dataProvider = "getCSVData",dataProviderClass=AddGroupsDataProvider.class,dependsOnGroups={"loginGroup"},groups="addGroup")
public void AddGroup(String groupName,String displayName,String description) {
addGroupPage.addGroup(groupName, displayName, description);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
}//End of AddGroupTest Class.
Add Location test Case
public class AddLocationTest extends BaseSeleniumTest {
AddLocationPage addLocationPage;
@BeforeMethod
public void openAddLocationPage() {
addLocationPage = PageFactory.initElements(driver, AddLocationPage.class);
addLocationPage.openPage();
}
@Test(dataProvider = "getCSVData", dataProviderClass = AddLocationDataProvider.class, dependsOnGroups = { "loginGroup" }, groups = "addLocation")
public void addLocation(String locationName, String displayName,
String description, String groups) {
addLocationPage.addLocation(locationName, displayName, description,
groups.split(","));
}
}
when I run this script independently they run perfectly now I want to run this scripts as suite but I don't know where to start from. As my Add Location Test case dependent on Add Group and Add Group test case is dependent on Login test case.
following are my questions
Thanks in advance...
Upvotes: 0
Views: 7138
Reputation: 10329
Your question leads to an opinion-based answer, which is generally off-topic for SO. Consider looking through Software Quality Assurance & Testing Stack Exchange.
I'm going to attempt to give you at least some answer. You should:
Upvotes: 1