-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec06520
commit e9199c3
Showing
5 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Java, Selenium, RemoteWebDriver, Parallel Execution, TestNG, Maven Profiles @RV | ||
|
||
This project shows the core concepts of RemoteWebDriver, TestNG, Parallel execution and Maven profiles. | ||
|
||
It can be easily integrated with **Selenium Grid** or **Docker (Zalenium)**. | ||
|
||
**CLI execution:** `mvn clean test -Pparallel` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.remote.DesiredCapabilities; | ||
import org.openqa.selenium.remote.RemoteWebDriver; | ||
import org.testng.Assert; | ||
import org.testng.ITestContext; | ||
import org.testng.annotations.AfterTest; | ||
import org.testng.annotations.BeforeTest; | ||
import org.testng.annotations.Test; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* @author Razvan Vancea | ||
*/ | ||
public class GithubTest { | ||
|
||
private WebDriver driver; | ||
|
||
@BeforeTest | ||
public void setupDriver(ITestContext ctx){ | ||
DesiredCapabilities cap; | ||
cap = DesiredCapabilities.chrome(); | ||
|
||
String host = "http://localhost:4444/wd/hub"; | ||
|
||
String testName = ctx.getCurrentXmlTest().getName(); | ||
cap.setCapability("name", testName); | ||
|
||
try { | ||
this.driver = new RemoteWebDriver(new URL(host), cap); | ||
} catch (MalformedURLException e){ | ||
e.printStackTrace(); | ||
} | ||
|
||
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); | ||
} | ||
|
||
@Test | ||
public void assertGithubRepoTitle(){ | ||
driver.get("https://github.com/razvanvancea"); | ||
|
||
String currentTitle = driver.getTitle(); | ||
String expectedTitle = "razvanvancea (RV) · GitHub"; | ||
|
||
Assert.assertEquals(currentTitle, expectedTitle); | ||
} | ||
|
||
@AfterTest | ||
public void tearDown(){ | ||
this.driver.quit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> | ||
<suite name="zalenium tests" parallel="tests"> | ||
|
||
<test name="basic1"> | ||
<classes> | ||
<class name="SimpleTest"/> | ||
<class name="ZaleniumTest"/> | ||
<class name="GithubTest"/> | ||
</classes> | ||
</test> | ||
|
||
<test name="basic2"> | ||
<classes> | ||
<class name="SimpleTest"/> | ||
<class name="ZaleniumTest"/> | ||
</classes> | ||
</test> | ||
|
||
<test name="basic3"> | ||
<classes> | ||
<class name="SimpleTest"/> | ||
<class name="GithubTest"/> | ||
</classes> | ||
</test> | ||
|
||
<test name="basic4"> | ||
<classes> | ||
<class name="SimpleTest"/> | ||
<class name="ZaleniumTest"/> | ||
</classes> | ||
</test> | ||
|
||
<test name="basic5"> | ||
<classes> | ||
<class name="SimpleTest"/> | ||
<class name="GithubTest"/> | ||
</classes> | ||
</test> | ||
</suite> |