Skip to content

Commit e20f743

Browse files
committed
AppTesting
0 parents  commit e20f743

45 files changed

Lines changed: 2668 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.classpath

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="test" value="true"/>
17+
<attribute name="optional" value="true"/>
18+
<attribute name="maven.pomderived" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
22+
<attributes>
23+
<attribute name="test" value="true"/>
24+
<attribute name="maven.pomderived" value="true"/>
25+
</attributes>
26+
</classpathentry>
27+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
28+
<attributes>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
33+
<attributes>
34+
<attribute name="maven.pomderived" value="true"/>
35+
</attributes>
36+
</classpathentry>
37+
<classpathentry kind="lib" path="C:/jar_files.zip"/>
38+
<classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>
39+
<classpathentry kind="output" path="target/classes"/>
40+
</classpath>

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target/
2+
/bin/

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>BanjaraRide_MobileApp_Testing--With_AppiumJava</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=disabled
8+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

chromedriver.exe

12.2 MB
Binary file not shown.

extent.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extent.reporter.spark.start=true
2+
extent.reporter.spark.out=Reports/Spark.html

pom.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>mobile-testing-Peoject2</groupId>
4+
<artifactId>mobile-testing-Peoject2</artifactId>
5+
<version>0.0.1-SNAPSHOT</version>
6+
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<groupId>org.apache.maven.plugins</groupId>
11+
<artifactId>maven-compiler-plugin</artifactId>
12+
<version>3.11.0</version>
13+
</plugin>
14+
<plugin>
15+
<groupId>org.apache.maven.plugins</groupId>
16+
<artifactId>maven-surefire-plugin</artifactId>
17+
<version>3.0.0-M5</version>
18+
<configuration>
19+
<suiteXmlFiles>
20+
<suiteXmlFile>testng.xml</suiteXmlFile>
21+
</suiteXmlFiles>
22+
</configuration>
23+
</plugin>
24+
</plugins>
25+
</build>
26+
27+
<dependencies>
28+
29+
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
30+
<dependency>
31+
<groupId>org.seleniumhq.selenium</groupId>
32+
<artifactId>selenium-java</artifactId>
33+
<version>3.141.59</version>
34+
</dependency>
35+
36+
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
37+
<dependency>
38+
<groupId>io.appium</groupId>
39+
<artifactId>java-client</artifactId>
40+
<version>7.3.0</version>
41+
</dependency>
42+
43+
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
44+
<dependency>
45+
<groupId>org.testng</groupId>
46+
<artifactId>testng</artifactId>
47+
<version>7.7.1</version>
48+
<scope>test</scope>
49+
</dependency>
50+
51+
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
52+
<dependency>
53+
<groupId>org.apache.commons</groupId>
54+
<artifactId>commons-lang3</artifactId>
55+
<version>3.12.0</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>com.aventstack</groupId>
59+
<artifactId>extentreports</artifactId>
60+
<version>5.0.9</version>
61+
</dependency>
62+
63+
64+
65+
</dependencies>
66+
67+
</project>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package Demo.appiumFramework;
2+
import java.io.FileReader;
3+
import java.io.IOException;
4+
import java.net.ServerSocket;
5+
import java.net.URL;
6+
import java.util.Properties;
7+
import org.openqa.selenium.remote.DesiredCapabilities;
8+
9+
import io.appium.java_client.MobileElement;
10+
import io.appium.java_client.android.AndroidDriver;
11+
import io.appium.java_client.android.AndroidElement;
12+
import io.appium.java_client.remote.AndroidMobileCapabilityType;
13+
import io.appium.java_client.remote.AutomationName;
14+
import io.appium.java_client.remote.MobileCapabilityType;
15+
import io.appium.java_client.service.local.AppiumDriverLocalService;
16+
public class Capability_Ride {
17+
public static String deviceName;
18+
public static String platformName;
19+
public static String appPackage;
20+
public static String appActivity;
21+
public static String chromeDriver;
22+
public static Process rt;
23+
public static AppiumDriverLocalService service;
24+
//i am trying start my appium by default in my console window
25+
// public static boolean checkifserverisRunning(int port)
26+
// {
27+
// boolean isServerRunning=false;
28+
// ServerSocket serversocket;
29+
// try{
30+
// serversocket = new ServerSocket(port);
31+
// serversocket.close();
32+
// }
33+
// catch(IOException e)
34+
// {
35+
// isServerRunning = true;
36+
// }
37+
// finally {
38+
// serversocket=null;
39+
// }
40+
// return isServerRunning;
41+
// }
42+
public AppiumDriverLocalService startserver()
43+
{
44+
boolean flag = checkifserverisRunning(4723);
45+
if(!flag)
46+
{
47+
service = AppiumDriverLocalService.buildDefaultService();
48+
}
49+
return service;
50+
51+
}
52+
public static boolean checkifserverisRunning(int port)
53+
{
54+
boolean isServerRunning=false;
55+
ServerSocket serversocket;
56+
try{
57+
serversocket = new ServerSocket(port);
58+
serversocket.close();
59+
}
60+
catch(IOException e)
61+
{
62+
isServerRunning = true;
63+
}
64+
finally {
65+
serversocket=null;
66+
}
67+
return isServerRunning;
68+
}
69+
public static AppiumDriverLocalService startAppium() {
70+
service= AppiumDriverLocalService.buildDefaultService();
71+
return service;
72+
}
73+
74+
//public static void startEmulator() throws IOException, InterruptedException {
75+
// rt = Runtime.getRuntime().exec("C:\\Users\\user\\OneDrive\\Desktop\\emulator.bat");
76+
// Thread.sleep(10000);
77+
// }
78+
79+
public static AndroidDriver<AndroidElement> hybridCapability() throws IOException, InterruptedException {
80+
//startEmulator();
81+
FileReader fReader = new FileReader(System.getProperty("user.dir")+"\\src\\main\\java\\Global.properties");
82+
Properties ps = new Properties();
83+
ps.load(fReader);
84+
deviceName = ps.getProperty("devicename");
85+
platformName = ps.getProperty("platformname");
86+
appPackage = ps.getProperty("apppackage");
87+
appActivity = ps.getProperty("appactivity");
88+
chromeDriver = ps.getProperty("chromeexecutables");
89+
DesiredCapabilities dc = new DesiredCapabilities();
90+
dc.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
91+
dc.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName);
92+
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, appPackage);
93+
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, appActivity);
94+
dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
95+
dc.setCapability(MobileCapabilityType.NO_RESET, true);
96+
dc.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, chromeDriver);
97+
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("http://0.0.0.0:4723/wd/hub"),dc);
98+
//AndroidDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), dc);
99+
100+
return driver;
101+
}
102+
}

src/main/java/Global.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
deviceName = Devendra
3+
platformName = Android
4+
apppackage = com.forbinary.banjararide
5+
appactivity = com.forbinary.banjararide.activity.SplashActivity
6+
chromeExecutable = C:\\chromedriver_win32\\chromedriver.exe
7+

0 commit comments

Comments
 (0)