bichromate.mobile.bichromateAppiumServerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Bichromate Show documentation
Show all versions of Bichromate Show documentation
Java, Selenium, Appium, Winium, Extend, and TestNG automated testing framework. Bichromate integrates the best of these frameworks and takes automation to the next level. With Bichromate there is one function call that builds any type of Web,IOS Mobile, Android, and Windows App driver on any platform (Windows, Mac, Linux). From Local web drivers, to SauceLabs, Browserstack, and Selenium grid. Build data driven tests is never easier.
Bichromate also gives you built in Factories that, access DBs, Video Capture, FTP, POM Generation, Hilite element.
package bichromate.mobile;
import java.io.IOException;
import bichromate.core.sTestOSInformationFactory;
public class bichromateAppiumServerFactory {
private static Process process;
sTestOSInformationFactory os = null;
// private static String APPIUMSERVERSTART = "node /home/adminuser/Java_Projects/Appium/appium";
private String APPIUMSERVERSTART = "node appium --address 127.0.0.1 --port 4723";
public bichromateAppiumServerFactory(){
os = new sTestOSInformationFactory();
}
public void startAppiumServer(){
APPIUMSERVERSTART = new String(APPIUMSERVERSTART +" --log "+os.getLogFileDirectory()+"appium.log");
try{
Runtime runtime = Runtime.getRuntime();
process = runtime.exec(APPIUMSERVERSTART);
Thread.sleep(5000);
if (process != null) {
System.out.println("bichromateAppiumServerFactory:startAppiumServer - Appium server started");
}
}catch (IOException ioe){
System.out.println("bichromateAppiumServerFactory:startAppiumServer - Appium server IOException");
} catch (InterruptedException ie){
System.out.println("bichromateAppiumServerFactory:startAppiumServer - Appium server InterruptedException");
}
}//startAppiumServer
public void stopAppiumServer() throws IOException{
if (process != null) {
process.destroy();
}
System.out.println("Appium server stop");
process = null;
}// stopAppiumServer
private void test() throws InterruptedException{
startAppiumServer();
try {
try {
Thread.sleep(5000);
stopAppiumServer();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
stopAppiumServer();
} catch (IOException e) {
System.out.println("bichromateAppiumServerFactory:test - Appium server IOException");
e.printStackTrace();
}
}
//
// Inner class for testing on the command line
//
public static class Test
{
public static void main(final String[] args){
bichromateAppiumServerFactory as = new bichromateAppiumServerFactory();
if(null != as){
try {
as.test();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}//main
}//Test
}