Closed libuser123 closed 8 years ago
Hrm, that is indeed strange. I'm going to be releasing a new version of ci-sauce today with the latest sauce connect
I know ci-sauce includes its saucerest, I wonder if there's a signature mismatch or something.
https://search.maven.org/#artifactdetails%7Ccom.saucelabs%7Cci-sauce%7C1.113%7Cjar
1.113 is now out, want to try that one?
just updated not working right. here is my complete pom but i need all the basic ones which are junit and ci and it just does not see the method. '<?xml version="1.0" encoding="UTF-8"?> <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">
<artifactId>automation</artifactId>
<groupId>aarp</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sauce_quickstart</name>
<description>A sample Maven project that demonstrates how to integrate Sauce OnDemand with WebDriver tests
that run using JUnit
</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.3.2.v20150730</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-path</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured-common</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<!-- To use the legacy, Jetty-based implementation,
change the artifactId to browsermob-core -->
<artifactId>browsermob-core-littleproxy</artifactId>
<version>2.1.0-beta-4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_junit</artifactId>
<version>2.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.51.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>ci-sauce</artifactId>
<version>1.113</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.saucelabs.maven.plugin</groupId>
<artifactId>sauce-connect-plugin</artifactId>
<version>2.1.21</version>
<configuration>
<sauceUsername>X</sauceUsername>
<sauceAccessKey>X</sauceAccessKey>
</configuration>
<executions>
<!-- Start Sauce Connect prior to running the integration tests -->
<execution>
<id>start-sauceconnect</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-sauceconnect</goal>
</goals>
</execution>
<!-- Stop the Sauce Connect process after the integration tests have finished -->
<execution>
<id>stop-sauceconnect</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-sauceconnect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- <includes> <include>**/*IT.java</include> </includes> -->
<failIfNoTests>true</failIfNoTests>
</configuration>
</plugin>
<!-- Plugin to send Mail -->
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send_an_email</id>
<phase>integration-test</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<mailhost>smtp.gmail.com</mailhost>
<mailport>X</mailport>
<mailssl>true</mailssl>
<mailAltConfig>true</mailAltConfig>
<mailuser>aarp.smoketest@gmail.com</mailuser>
<mailpassword>X</mailpassword>
<from>X</from>
<receivers>
<receiver>X</receiver>
</receivers>
<fileSets>
<fileSet>
<directory>${basedir}/target/surefire-reports</directory>
<includes>
<include>emailable-report.html</include>
</includes>
</fileSet>
</fileSets>
<subject>Smoke Test Build Status - ${maven.build.timestamp}</subject>
<failonerror>true</failonerror>
<htmlMessage> <![CDATA[ <p>Hello, The Test Report for the current smoke-test is attached to this e-mail.</p><br><br><p>This is an
auto generated email, please do not reply.</p> ]]>
</htmlMessage>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>saucelabs-repository</id>
<url>https://repository-saucelabs.forge.cloudbees.com/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
'
@libuser123 You may want to run mvn versions:display-dependency-updates
and update your dependencies as shown to be safe. Your sauce_junit version is very old.
thanks for catching the version. Updated to the latest
Would you care to share some code around the request?
by all means trying to automate analytics software and so far i am having luck on my local but when i try to initialize the tunnel im getting these errors:
package Selenium;
//import static org.junit.Assert.assertEquals;
//import static org.junit.Assert.assertTrue;
//import static org.junit.Assert.fail;
import static org.testng.AssertJUnit.assertEquals;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
//import org.junit.After;
//import org.junit.Before;
//import org.junit.Test;
import net.lightbody.bmp.BrowserMobProxy;
import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.core.har.Har;
import org.json.simple.JSONArray;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.FindAll;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.*;
import static org.junit.Assert.*;
import com.saucelabs.ci.sauceconnect.SauceConnectFourManager;
import com.saucelabs.ci.sauceconnect.SauceTunnelManager;
import com.saucelabs.common.SauceOnDemandAuthentication;
import com.saucelabs.common.SauceOnDemandSessionIdProvider;
import com.saucelabs.junit.SauceOnDemandTestWatcher;
import com.saucelabs.saucerest.SauceREST;
import static junit.framework.Assert.assertEquals;
public class OmnitureTrackingHomePageTestNg implements SauceOnDemandSessionIdProvider{
private WebDriver driver;
private String baseUrl;
private String sessionId;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@BeforeClass
public void setUp() throws Exception {
Properties prop = new Properties();
InputStream is = new FileInputStream("common.properties");
prop.load(is);
DesiredCapabilities capabillities = DesiredCapabilities.firefox();
capabillities.setCapability("version", "44.0");
capabillities.setCapability("name", "Omniture Home Page Test");
capabillities.setCapability("platform", "Windows 8.1");
capabillities.setCapability("public", "");
capabillities.setCapability("passed", false);
//Removing identifier due to issues with it on Jenkins
//capabillities.setCapability("tunnel-identifier", prop.getProperty("tunnel-identifier"));
capabillities.setCapability("max-duration", "300");
this.driver = new RemoteWebDriver(
new URL("http://"+ prop.getProperty("accountname") + ":" + prop.getProperty("apikey") + "@ondemand.saucelabs.com:80/wd/hub"),
capabillities);
baseUrl = "http://localhost:8080";
this.sessionId = ((RemoteWebDriver)driver).getSessionId().toString();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
SauceConnectFourManager sauceTunnelManager = new SauceConnectFourManager();
sauceTunnelManager.openConnection(
"usrcloud", // username
"---deleted by gavin---", // apiKey
4445, // port
null, // sauceConnectJar
null, // Tunnel options
null, // printStream
null, // verboseLogging
null // sauceConnectPath
);
}
@Override
public String getSessionId() {
return sessionId;
}
@Test
public void LogInMobileTestNgTest() throws Exception {
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
Properties prop = new Properties();
InputStream is = new FileInputStream("common.properties");
prop.load(is);
SauceREST client = new SauceREST(prop.getProperty("accountname"), prop.getProperty("apikey"));
Map<String, Object> updates = new HashMap<String, Object>();
JSONArray tags = new JSONArray();
tags.add(baseUrl);
updates.put("tags", tags);
//updates.put("build", "c234");
client.updateJobInfo(sessionId, updates);
hmac_md5 md5 = new hmac_md5();
String md5Key = md5.hmacDigest(sessionId, prop.getProperty("accountname") + ":" + prop.getProperty("apikey") , "HmacMD5");
proxy.newHar(baseUrl);
driver.get(baseUrl);
Har har = proxy.getHar();
har.getLog();
har.writeTo(new File("c:\\temp\\har"));
StringBuilder HARFile = readFile("c:\\temp\\har");
if (HARFile.indexOf("metrics.aarp.org/b/ss/aarpglobal/") > -1 )
System.out.println("Omniture call fired");
else System.out.println("Omniture call not fired");
if (HARFile.indexOf("&c1=homepage&c2=homepage&c3=homepage&c4=homepage&c5=homepage")>-1)
System.out.println("c1,c2,c3,c4,c5 Parameter fired");
else System.out.println("c1,c2,c3,c4,c5 Parameter not fired");
if (HARFile.indexOf("c7=aarporg&v7=aarporg")>-1)
System.out.println("c7 and v7 Parameter fired");
else System.out.println("c7 and v7 Parameter not fired");
if (HARFile.indexOf("c10=aarp/components/page/landing")>-1)
System.out.println("c10 Parameter fired");
else System.out.println("c10 Parameter not fired");
if (HARFile.indexOf("v10=www")>-1)
System.out.println("v10 Parameter fired");
else System.out.println("v10 Parameter not fired");
if (HARFile.indexOf("&c11=english")>-1)
System.out.println("c11 Parameter fired");
else System.out.println("c11 Parameter not fired");
if (HARFile.indexOf("c13=Publication")>-1)
System.out.println("c13 Parameter fired");
else System.out.println("c13 Parameter not fired");
if (HARFile.indexOf("c20=aarporg")>-1)
System.out.println("c20 Parameter fired");
else System.out.println("c20 Parameter not fired");
if (HARFile.indexOf("&c30=AARP - Bringing Real Possibilities to Life")>-1)
System.out.println("c30 Parameter fired");
else System.out.println("c30 Parameter not fired");
if (HARFile.indexOf("&c32=commercial")>-1)
System.out.println("c32 Parameter fired");
else System.out.println("c32 Parameter not fired");
if (HARFile.indexOf("&c34=/content/aarpe/en/home")>-1)
System.out.println("c34 Parameter fired");
else System.out.println("c34 Parameter not fired");
if (HARFile.indexOf("&c40=main_homepage")>-1)
System.out.println("c40 Parameter fired");
else System.out.println("c40 Parameter not fired");
if (HARFile.indexOf("&v40=main_homepage")>-1)
System.out.println("v40 Parameter fired");
else System.out.println("v40 Parameter not fired");
if (HARFile.indexOf("&c42=aarporg")>-1)
System.out.println("c42 Parameter fired");
else System.out.println("c42 Parameter not fired");
if (HARFile.indexOf("&v42=aarporg")>-1)
System.out.println("v42 Parameter fired");
else System.out.println("v42 Parameter not fired");
if (HARFile.indexOf("&c43=None")>-1)
System.out.println("c43 Parameter fired");
else System.out.println("c43 Parameter not fired");
if (HARFile.indexOf("&v46=aarporg")>-1)
System.out.println("v46 Parameter fired");
else System.out.println("v46 Parameter not fired");
if (HARFile.indexOf("c50=www:")>-1)
System.out.println("c50 Parameter fired");
else System.out.println("c50 Parameter not fired");
if (HARFile.indexOf("&v67=aarpe")>-1)
System.out.println("v67 Parameter fired");
else System.out.println("v67 Parameter not fired");
if (HARFile.indexOf("&h1=homepage")>-1)
System.out.println("h1 Parameter fired");
else System.out.println("h1 Parameter not fired");
}
@AfterClass
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
public static StringBuilder readFile(String path)
{
// Assumes that a file article.rss is available on the SD card
File file = new File(path);
StringBuilder builder = new StringBuilder();
if (!file.exists()) {
throw new RuntimeException("File not found");
}
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return builder;
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
@libuser123 ps, i updated your comment to use three backticks to escape the code
@libuser123 I finally got around to looking at your code. First block is the modified class. To get browsermob working you need to do more work, but this one now runs a "test" through a tunnel and updates results. The second blob is the pom.xml... Just @ mention me, if you need more help.
//import static org.junit.Assert.assertEquals;
//import static org.junit.Assert.assertTrue;
//import static org.junit.Assert.fail;
import static org.testng.AssertJUnit.assertEquals;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
//import org.junit.After;
//import org.junit.Before;
//import org.junit.Test;
import net.lightbody.bmp.BrowserMobProxy;
import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.core.har.Har;
import org.json.simple.JSONArray;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.FindAll;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
//import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.*;
import org.testng.*;
import static org.junit.Assert.*;
import com.saucelabs.ci.sauceconnect.SauceConnectFourManager;
import com.saucelabs.ci.sauceconnect.SauceTunnelManager;
import com.saucelabs.common.SauceOnDemandAuthentication;
import com.saucelabs.common.SauceOnDemandSessionIdProvider;
import com.saucelabs.junit.SauceOnDemandTestWatcher;
import com.saucelabs.saucerest.SauceREST;
import static junit.framework.Assert.assertEquals;
public class OmnitureTrackingHomePageTestNg implements SauceOnDemandSessionIdProvider{
private WebDriver driver;
private String baseUrl;
private String sessionId;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
SauceConnectFourManager sauceTunnelManager;
SauceREST client = new SauceREST(System.getenv("SAUCE_USERNAME"), System.getenv("SAUCE_ACCESS_KEY"));
@BeforeClass
public void setUp() throws Exception {
sauceTunnelManager = new SauceConnectFourManager();
sauceTunnelManager.openConnection(
System.getenv("SAUCE_USERNAME"), // username
System.getenv("SAUCE_ACCESS_KEY"), // apiKey
4445, // port
null, // sauceConnectJar
null, // Tunnel options
null, // printStream
null, // verboseLogging
null // sauceConnectPath
);
//Properties prop = new Properties();
//InputStream is = new FileInputStream("");
//prop.load(is);
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("version", "44.0");
capabilities.setCapability("name", "Omniture Home Page Test");
capabilities.setCapability("platform", "Windows 8.1");
capabilities.setCapability("public", "");
//capabilities.setCapability("passed", false);
//Removing identifier due to issues with it on Jenkins
//capabilities.setCapability("tunnel-identifier", prop.getProperty("tunnel-identifier"));
capabilities.setCapability("max-duration", "300");
this.driver = new RemoteWebDriver(
new URL("http://"+ System.getenv("SAUCE_USERNAME") + ":" + System.getenv("SAUCE_ACCESS_KEY") + "@ondemand.saucelabs.com:80/wd/hub"),
capabilities);
baseUrl = "http://localhost:8080";
this.sessionId = ((RemoteWebDriver)driver).getSessionId().toString();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Override
public String getSessionId() {
return sessionId;
}
@Test
public void LogInMobileTestNgTest() throws Exception {
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
//Properties prop = new Properties();
//InputStream is = new FileInputStream("common.properties");
//prop.load(is);
Map<String, Object> updates = new HashMap<String, Object>();
JSONArray tags = new JSONArray();
tags.add(baseUrl);
updates.put("tags", tags);
//updates.put("build", "c234");
client.updateJobInfo(sessionId, updates);
//hmac_md5 md5 = new hmac_md5();
//String md5Key = md5.hmacDigest(sessionId, prop.getProperty("accountname") + ":" + prop.getProperty("apikey") , "HmacMD5");
proxy.newHar(baseUrl);
driver.get(baseUrl);
Har har = proxy.getHar();
har.getLog();
har.writeTo(new File("c:\\temp\\har"));
StringBuilder HARFile = readFile("c:\\temp\\har");
if (HARFile.indexOf("metrics.aarp.org/b/ss/aarpglobal/") > -1 )
System.out.println("Omniture call fired");
else System.out.println("Omniture call not fired");
if (HARFile.indexOf("&c1=homepage&c2=homepage&c3=homepage&c4=homepage&c5=homepage")>-1)
System.out.println("c1,c2,c3,c4,c5 Parameter fired");
else System.out.println("c1,c2,c3,c4,c5 Parameter not fired");
if (HARFile.indexOf("c7=aarporg&v7=aarporg")>-1)
System.out.println("c7 and v7 Parameter fired");
else System.out.println("c7 and v7 Parameter not fired");
if (HARFile.indexOf("c10=aarp/components/page/landing")>-1)
System.out.println("c10 Parameter fired");
else System.out.println("c10 Parameter not fired");
if (HARFile.indexOf("v10=www")>-1)
System.out.println("v10 Parameter fired");
else System.out.println("v10 Parameter not fired");
if (HARFile.indexOf("&c11=english")>-1)
System.out.println("c11 Parameter fired");
else System.out.println("c11 Parameter not fired");
if (HARFile.indexOf("c13=Publication")>-1)
System.out.println("c13 Parameter fired");
else System.out.println("c13 Parameter not fired");
if (HARFile.indexOf("c20=aarporg")>-1)
System.out.println("c20 Parameter fired");
else System.out.println("c20 Parameter not fired");
if (HARFile.indexOf("&c30=AARP - Bringing Real Possibilities to Life")>-1)
System.out.println("c30 Parameter fired");
else System.out.println("c30 Parameter not fired");
if (HARFile.indexOf("&c32=commercial")>-1)
System.out.println("c32 Parameter fired");
else System.out.println("c32 Parameter not fired");
if (HARFile.indexOf("&c34=/content/aarpe/en/home")>-1)
System.out.println("c34 Parameter fired");
else System.out.println("c34 Parameter not fired");
if (HARFile.indexOf("&c40=main_homepage")>-1)
System.out.println("c40 Parameter fired");
else System.out.println("c40 Parameter not fired");
if (HARFile.indexOf("&v40=main_homepage")>-1)
System.out.println("v40 Parameter fired");
else System.out.println("v40 Parameter not fired");
if (HARFile.indexOf("&c42=aarporg")>-1)
System.out.println("c42 Parameter fired");
else System.out.println("c42 Parameter not fired");
if (HARFile.indexOf("&v42=aarporg")>-1)
System.out.println("v42 Parameter fired");
else System.out.println("v42 Parameter not fired");
if (HARFile.indexOf("&c43=None")>-1)
System.out.println("c43 Parameter fired");
else System.out.println("c43 Parameter not fired");
if (HARFile.indexOf("&v46=aarporg")>-1)
System.out.println("v46 Parameter fired");
else System.out.println("v46 Parameter not fired");
if (HARFile.indexOf("c50=www:")>-1)
System.out.println("c50 Parameter fired");
else System.out.println("c50 Parameter not fired");
if (HARFile.indexOf("&v67=aarpe")>-1)
System.out.println("v67 Parameter fired");
else System.out.println("v67 Parameter not fired");
if (HARFile.indexOf("&h1=homepage")>-1)
System.out.println("h1 Parameter fired");
else System.out.println("h1 Parameter not fired");
}
@AfterMethod
public void afterMethod(ITestResult testResult){
Map<String, Object> updates = new HashMap<String, Object>();
updates.put("passed", testResult.getStatus() == 1);
client.updateJobInfo(getSessionId(), updates);
}
@AfterClass
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
sauceTunnelManager.closeTunnelsForPlan(System.getenv("SAUCE_USERNAME"), null, System.out);
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
public static StringBuilder readFile(String path)
{
// Assumes that a file article.rss is available on the SD card
File file = new File(path);
StringBuilder builder = new StringBuilder();
if (!file.exists()) {
throw new RuntimeException("File not found");
}
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return builder;
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<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.yourcompany</groupId>
<artifactId>Selenium</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.3.8.v20160314</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-path</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured-common</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<!-- To use the legacy, Jetty-based implementation,
change the artifactId to browsermob-core -->
<artifactId>browsermob-core-littleproxy</artifactId>
<version>2.1.0-beta-4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_junit</artifactId>
<version>2.1.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>ci-sauce</artifactId>
<version>1.113</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.saucelabs.maven.plugin</groupId>
<artifactId>sauce-connect-plugin</artifactId>
<version>2.1.21</version>
<configuration>
<sauceUsername>X</sauceUsername>
<sauceAccessKey>X</sauceAccessKey>
</configuration>
<executions>
<!-- Start Sauce Connect prior to running the integration tests -->
<execution>
<id>start-sauceconnect</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-sauceconnect</goal>
</goals>
</execution>
<!-- Stop the Sauce Connect process after the integration tests have finished -->
<execution>
<id>stop-sauceconnect</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-sauceconnect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- <includes> <include>**/*IT.java</include> </includes> -->
<failIfNoTests>true</failIfNoTests>
</configuration>
</plugin>
<!-- Plugin to send Mail -->
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send_an_email</id>
<phase>integration-test</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<mailhost>smtp.gmail.com</mailhost>
<mailport>X</mailport>
<mailssl>true</mailssl>
<mailAltConfig>true</mailAltConfig>
<mailuser>aarp.smoketest@gmail.com</mailuser>
<mailpassword>X</mailpassword>
<from>X</from>
<receivers>
<receiver>X</receiver>
</receivers>
<fileSets>
<fileSet>
<directory>${basedir}/target/surefire-reports</directory>
<includes>
<include>emailable-report.html</include>
</includes>
</fileSet>
</fileSets>
<subject>Smoke Test Build Status - ${maven.build.timestamp}</subject>
<failonerror>true</failonerror>
<htmlMessage> <![CDATA[ <p>Hello, The Test Report for the current smoke-test is attached to this e-mail.</p><br><br><p>This is an
auto generated email, please do not reply.</p> ]]>
</htmlMessage>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have the following in my pom: `
And Get the following code: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. FAILED CONFIGURATION: @BeforeClass setUp java.lang.NoSuchMethodError: com.saucelabs.saucerest.SauceREST.getTunnels()Ljava/lang/String; at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.activeTunnelIdentifier(AbstractSauceTunnelManager.java:424) at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:282) at Selenium.OmnitureTrackingHomePageTestNg.setUp(OmnitureTrackingHomePageTestNg.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
SKIPPED CONFIGURATION: @AfterClass tearDown SKIPPED: LogInMobileTestNgTest
Default suite Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@4ec6948c: 91 ms [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 14 ms [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@5b065904: 9 ms [TestNG] Time taken by org.testng.reporters.XMLReporter@11331ce6: 12 ms [TestNG] Time taken by org.testng.reporters.EmailableReporter2@27d43d30: 9 ms [TestNG] Time taken by org.testng.reporters.jq.Main@3a15c018: 62 ms
I checked and saw that the method is there but I have no idea what am I doing wrong...