diff --git a/.gitignore b/.gitignore
index 6695bd7..7a7dca1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ gradle/
gradlew
gradlew.bat
gradle.properties
+.DS_Store
\ No newline at end of file
diff --git a/README.md b/README.md
index 1e0484c..c8937c6 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,16 @@
-Examples showing how to utilize [testable-selenium-java](https://github.com/testable/testable-selenium-java).
+Examples showing how to utilize [testable-selenium-java](https://github.com/testable/testable-selenium-java) and how to run tests on Testable.
+This includes via main class, JUnit, and TestNG and built via either Maven or Gradle.
-When running on Testable, if the project source is uploaded as a zip file
-or linked to version control either Gradle or Mabe used to do a build
-by auto-detecting a build.gradle or pom.xml file
-in the root of the repository. If both are detected, Gradle will be used.
+Examples:
-Testable will run the main class specified in the scenario on the test runner.
\ No newline at end of file
+* `MainSampleTest`: Main class that loads Google and takes a screenshot.
+* `JUnitSampleTest`: JUnit test that loads Google and takes a screenshot.
+* `TestNGSampleTest`: TestNG test that loads Google and takes a screenshot.
+
+There a variety of ways to run this on Testable:
+
+* Upload a jar and specify the main class or test classes
+* Upload an executable jar that runs your main class
+* Upload this project in a zip file. Choose Gradle or Maven as the build tool and specify the right goals:
+ * `Gradle`: `build test` (for JUnit/TestNG) or `build run` (for main class)
+ * `Maven`: `test` (for JUnit/TestNG) or `compile exec:exec` (for main class)
diff --git a/build.gradle b/build.gradle
index d6751c6..36bd915 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,50 @@
+plugins {
+ id 'application'
+ id 'java'
+}
+
group 'io.testable'
version '0.1.0-SNAPSHOT'
-apply plugin: 'java'
-
repositories {
mavenCentral()
}
dependencies {
- implementation 'io.testable:testable-selenium-java:0.0.9'
- testImplementation 'junit:junit:4.13'
+ implementation 'io.testable:testable-selenium-java:0.0.24'
+ implementation 'com.google.guava:guava:30.1.1-jre'
+ testImplementation 'junit:junit:4.13.2'
+ testImplementation 'org.testng:testng:6.14.3'
+}
+
+
+application {
+ mainClass = 'io.testable.example.MainSampleTest'
+}
+
+tasks.named('test') {
+ if (Boolean.getBoolean("isTestNG"))
+ useTestNG()
+ else
+ useJUnit()
+}
+
+tasks.register('uberTestJar', Jar) {
+ dependsOn testClasses
+ manifest {
+ attributes 'Main-Class': 'io.testable.example.MainSampleTest'
+ }
+ sourceSets.main.output.each {
+ from it
+ }
+ sourceSets.test.output.each {
+ from it
+ }
+ from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
+ from { configurations.testRuntimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
+ with jar
+}
+
+run {
+ systemProperties System.getProperties()
}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..746870b
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,94 @@
+
+
+ 4.0.0
+ io.testable
+ testable-selenium-java-example
+ 0.1.0-SNAPSHOT
+
+
+ io.testable
+ testable-selenium-java
+ 0.0.24
+
+
+ com.google.guava
+ guava
+ 30.1.1-jre
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+ org.testng
+ testng
+ 6.14.3
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 1.8
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.1.0
+
+
+
+ junit
+ false
+
+
+ 1
+
+
+
+ org.apache.maven.surefire
+ surefire-junit47
+ 3.1.0
+
+
+ org.apache.maven.surefire
+ surefire-testng
+ 3.1.0
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+
+ exec
+
+
+
+
+ java
+
+ -classpath
+
+ io.testable.example.MainSampleTest
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/io/testable/selenium/TestableExample.java b/src/main/java/io/testable/example/MainSampleTest.java
similarity index 83%
rename from src/main/java/io/testable/selenium/TestableExample.java
rename to src/main/java/io/testable/example/MainSampleTest.java
index 7c19de8..5b638dd 100644
--- a/src/main/java/io/testable/selenium/TestableExample.java
+++ b/src/main/java/io/testable/example/MainSampleTest.java
@@ -1,12 +1,13 @@
-package io.testable.selenium;
+package io.testable.example;
+import io.testable.selenium.TestableSelenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/**
* Simple example of loading Google and taking a screenshot in a way that is compatible with the Testable platform.
*/
-public class TestableExample {
+public class MainSampleTest {
public static void main(String[] args) {
ChromeOptions options = new ChromeOptions();
diff --git a/src/test/java/io/testable/example/JUnitSampleTest.java b/src/test/java/io/testable/example/JUnitSampleTest.java
new file mode 100644
index 0000000..248712e
--- /dev/null
+++ b/src/test/java/io/testable/example/JUnitSampleTest.java
@@ -0,0 +1,20 @@
+package io.testable.example;
+
+import io.testable.selenium.TestableSelenium;
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+
+public class JUnitSampleTest {
+
+ @Test
+ public void testLoadGoogle() {
+ System.out.println("JUnit test");
+ ChromeOptions options = new ChromeOptions();
+ WebDriver driver = TestableSelenium.newWebDriver(options);
+ driver.get("https://www.google.com");
+ TestableSelenium.takeScreenshot(driver, "temp.png");
+ driver.close();
+ }
+
+}
diff --git a/src/test/java/io/testable/example/TestNGSampleTest.java b/src/test/java/io/testable/example/TestNGSampleTest.java
new file mode 100644
index 0000000..1ef4ff1
--- /dev/null
+++ b/src/test/java/io/testable/example/TestNGSampleTest.java
@@ -0,0 +1,21 @@
+package io.testable.example;
+
+import io.testable.selenium.TestableSelenium;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.testng.annotations.Test;
+
+public class TestNGSampleTest {
+
+ @Test
+ public void testLoadGoogle() {
+ System.out.println("TestNG test");
+ ChromeOptions options = new ChromeOptions();
+ WebDriver driver = TestableSelenium.newWebDriver(options);
+ driver.get("https://www.google.com");
+ TestableSelenium.takeScreenshot(driver, "temp.png");
+ driver.close();
+ }
+
+
+}
diff --git a/src/test/resources/testng.xml b/src/test/resources/testng.xml
new file mode 100644
index 0000000..b310233
--- /dev/null
+++ b/src/test/resources/testng.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file