Skip to content

Commit

Permalink
Merge branch 'Sandeep4odesk-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendrikse committed Oct 5, 2016
2 parents 1296f2e + ea63539 commit c93bc1b
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 115 deletions.
82 changes: 47 additions & 35 deletions selenium-junit-testng/pom.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>selenium-junit-testng</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>selenium-junit-testng</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testSourceDirectory></testSourceDirectory>
<includes>
<include>Test*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
public class SeleniumExample {

private WebDriver webDriver;
private final String url = "http://www.baeldung.com/";
private final String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials";

private String url = "http://www.baeldung.com/";

public SeleniumExample() {
webDriver = new FirefoxDriver();
webDriver.get(url);
Expand All @@ -18,12 +17,8 @@ public void closeWindow() {
webDriver.close();
}

public String getActualTitle() {
public String getTitle() {
return webDriver.getTitle();
}

public String getExpectedTitle() {
return expectedTitle;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test.java.com.baeldung.selenium.junit;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import main.java.com.baeldung.selenium.SeleniumExample;

import org.junit.After;
Expand All @@ -10,6 +11,7 @@
public class TestSeleniumWithJUnit {

private SeleniumExample seleniumExample;
private String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials";

@Before
public void setUp() {
Expand All @@ -23,8 +25,8 @@ public void tearDown() {

@Test
public void whenPageIsLoaded_thenTitleIsAsPerExpectation() {
String expectedTitle = seleniumExample.getExpectedTitle();
String actualTitle = seleniumExample.getActualTitle();
String actualTitle = seleniumExample.getTitle();
assertNotNull(actualTitle);
assertEquals(actualTitle, expectedTitle);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test.java.com.baeldung.selenium.testng;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import main.java.com.baeldung.selenium.SeleniumExample;

import org.testng.annotations.AfterSuite;
Expand All @@ -10,6 +11,7 @@
public class TestSeleniumWithTestNG {

private SeleniumExample seleniumExample;
private String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials";

@BeforeSuite
public void setUp() {
Expand All @@ -23,8 +25,8 @@ public void tearDown() {

@Test
public void whenPageIsLoaded_thenTitleIsAsPerExpectation() {
String expectedTitle = seleniumExample.getExpectedTitle();
String actualTitle = seleniumExample.getActualTitle();
String actualTitle = seleniumExample.getTitle();
assertNotNull(actualTitle);
assertEquals(actualTitle, expectedTitle);
}
}

This file was deleted.

This file was deleted.

0 comments on commit c93bc1b

Please sign in to comment.