Last active
January 21, 2018 03:05
-
-
Save krmahadevan/76527d3cc073f38c6dc218e4b8c9c4ae to your computer and use it in GitHub Desktop.
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
apply plugin: 'java' | |
apply plugin: 'maven' | |
group = 'com.rationaleemotions' | |
version = '1.0-SNAPSHOT' | |
description = """gradle-playground""" | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
tasks.withType(JavaCompile) { | |
options.encoding = 'UTF-8' | |
} | |
repositories { | |
maven { url "http://jcenter.bintray.com" } | |
maven { url "http://repo.maven.apache.org/maven2" } | |
} | |
dependencies { | |
compile group: 'org.testng', name: 'testng', version: '6.13.1' | |
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.8.1' | |
} | |
test { | |
useTestNG() { | |
suites "src/test/resources/testng.xml" | |
} | |
systemProperties(System.getProperties()) | |
testLogging.showStandardStreams = true | |
} |
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
08:32 $ gradle clean test -Durl="http://the-internet.herokuapp.com/" | |
> Task :test | |
Gradle Test Executor 9 STANDARD_OUT | |
... | |
... TestNG 6.13.1 by Cédric Beust (cedric@beust.com) | |
... | |
Sample_Suite > Sample_Test > com.rationaleemotions.SampleTest STANDARD_ERROR | |
Starting ChromeDriver 2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef) on port 12943 | |
Only local connections are allowed. | |
Jan 21, 2018 8:32:58 AM org.openqa.selenium.remote.ProtocolHandshake createSession | |
INFO: Detected dialect: OSS | |
Sample_Suite > Sample_Test > com.rationaleemotions.SampleTest.testMethod STANDARD_ERROR | |
URL = http://the-internet.herokuapp.com/ | |
Page Title :The Internet | |
BUILD SUCCESSFUL in 6s | |
5 actionable tasks: 5 executed |
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
08:33 $ tree src/ | |
src/ | |
├── main | |
│ └── java | |
│ └── com | |
│ └── rationaleemotions | |
│ └── App.java | |
└── test | |
├── java | |
│ └── com | |
│ └── rationaleemotions | |
│ └── SampleTest.java | |
└── resources | |
└── testng.xml | |
9 directories, 3 files |
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
package com.rationaleemotions; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
import org.testng.Assert; | |
import org.testng.annotations.AfterClass; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.Test; | |
public class SampleTest { | |
private RemoteWebDriver driver; | |
@BeforeClass | |
public void beforeClass() { | |
driver = new ChromeDriver(); | |
} | |
@Test | |
public void testMethod() { | |
String url = System.getProperty("url"); | |
Assert.assertNotNull(url, "URL should not have been a null value"); | |
System.err.println("URL = " + url); | |
driver.get(url); | |
System.err.println("Page Title :" + driver.getTitle()); | |
} | |
@AfterClass | |
public void afterClass() { | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> | |
<suite name="Sample_Suite" parallel="false" verbose="2"> | |
<test name="Sample_Test" verbose="2"> | |
<classes> | |
<class name="com.rationaleemotions.SampleTest"/> | |
</classes> | |
</test> | |
</suite> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment