Skip to content

Commit ce2f8da

Browse files
committed
fix(merge): Updates on library
2 parents a408bac + fe1a28d commit ce2f8da

File tree

10 files changed

+55
-35
lines changed

10 files changed

+55
-35
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- Love android-testing-guide? Please consider supporting our collective:
2+
👉 https://opencollective.com/android-testing-guide/donate -->

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Android Testing Guide [![Join the chat at https://gitter.im/android-testing-guide/Lobby](https://badges.gitter.im/android-testing-guide/Lobby.svg)](https://gitter.im/android-testing-guide/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1+
# Android Testing Guide [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20Testing%20Guide-brightgreen.svg?style=flat)](https://android-arsenal.com/details/3/6473) [![Backers on Open Collective](https://opencollective.com/android-testing-guide/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/android-testing-guide/sponsors/badge.svg)](#sponsors) [![Join the chat at https://gitter.im/android-testing-guide/Lobby](https://badges.gitter.im/android-testing-guide/Lobby.svg)](https://gitter.im/android-testing-guide/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22

33
### Show some :heart:
44
[![GitHub stars](https://img.shields.io/github/stars/ravidsrk/android-testing-guide.svg?style=social&label=Star)](https://github.com/ravidsrk/android-testing-guide) [![GitHub forks](https://img.shields.io/github/forks/ravidsrk/android-testing-guide.svg?style=social&label=Fork)](https://github.com/ravidsrk/android-testing-guide/fork) [![GitHub watchers](https://img.shields.io/github/watchers/ravidsrk/android-testing-guide.svg?style=social&label=Watch)](https://github.com/ravidsrk/android-testing-guide) [![GitHub followers](https://img.shields.io/github/followers/ravidsrk.svg?style=social&label=Follow)](https://github.com/ravidsrk/android-testing-guide)
@@ -808,3 +808,33 @@ emulator.press('KEYCODE_HOME','DOWN_AND_UP')
808808
* <https://github.com/designatednerd/Wino>
809809
* <http://chiuki.github.io/advanced-android-espresso/#/>
810810
* <http://www.vogella.com/tutorials/AndroidTestingEspresso/article.html>
811+
812+
## Contributors
813+
814+
This project exists thanks to all the people who contribute.
815+
<a href="graphs/contributors"><img src="https://opencollective.com/android-testing-guide/contributors.svg?width=890" /></a>
816+
817+
818+
## Backers
819+
820+
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/android-testing-guide#backer)]
821+
822+
<a href="https://opencollective.com/android-testing-guide#backers" target="_blank"><img src="https://opencollective.com/android-testing-guide/backers.svg?width=890"></a>
823+
824+
825+
## Sponsors
826+
827+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/android-testing-guide#sponsor)]
828+
829+
<a href="https://opencollective.com/android-testing-guide/sponsor/0/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/0/avatar.svg"></a>
830+
<a href="https://opencollective.com/android-testing-guide/sponsor/1/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/1/avatar.svg"></a>
831+
<a href="https://opencollective.com/android-testing-guide/sponsor/2/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/2/avatar.svg"></a>
832+
<a href="https://opencollective.com/android-testing-guide/sponsor/3/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/3/avatar.svg"></a>
833+
<a href="https://opencollective.com/android-testing-guide/sponsor/4/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/4/avatar.svg"></a>
834+
<a href="https://opencollective.com/android-testing-guide/sponsor/5/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/5/avatar.svg"></a>
835+
<a href="https://opencollective.com/android-testing-guide/sponsor/6/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/6/avatar.svg"></a>
836+
<a href="https://opencollective.com/android-testing-guide/sponsor/7/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/7/avatar.svg"></a>
837+
<a href="https://opencollective.com/android-testing-guide/sponsor/8/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/8/avatar.svg"></a>
838+
<a href="https://opencollective.com/android-testing-guide/sponsor/9/website" target="_blank"><img src="https://opencollective.com/android-testing-guide/sponsor/9/avatar.svg"></a>
839+
840+

SampleApp/app/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ dependencies {
4646
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
4747
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
4848
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
49+
50+
4951
}
5052

5153
// Log out test results to console
5254
tasks.matching { it instanceof Test }.all {
5355
testLogging.events = ["failed", "passed", "skipped"]
5456
}
57+
58+
tasks.withType(JavaCompile) {
59+
options.compilerArgs << "-Xlint:deprecation" << "-Werror"
60+
}

SampleApp/app/src/androidTest/java/in/ravidsrk/sample/MainActivityRobotiumTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import org.junit.Rule;
1010
import org.junit.Test;
1111

12-
import static junit.framework.Assert.assertTrue;
12+
import static org.junit.Assert.assertTrue;
13+
1314

1415
public class MainActivityRobotiumTest {
1516
private Solo solo;

SampleApp/app/src/androidTest/java/in/ravidsrk/sample/MainActivityTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,13 @@
4242
public class MainActivityTest {
4343

4444
@Rule
45-
public MainActivityTestRule<MainActivity> mainActivityActivityTestRule = new MainActivityTestRule<>(MainActivity.class);
46-
47-
@Rule
48-
public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class);
45+
public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class);
4946

5047
@Test
5148
public void testUI() {
52-
Activity activity = mainActivityActivityTestRule.getActivity();
49+
Activity activity = activityTestRule.getActivity();
5350
assertNotNull(activity.findViewById(R.id.text_hello));
54-
TextView helloView = (TextView) activity.findViewById(R.id.text_hello);
51+
TextView helloView = activity.findViewById(R.id.text_hello);
5552
assertTrue(helloView.isShown());
5653
assertEquals("Hello World!", helloView.getText());
5754
assertEquals(InstrumentationRegistry.getTargetContext().getString(R.string.hello_world), helloView.getText());
@@ -67,9 +64,9 @@ public void testRequiresDevice() {
6764
}
6865

6966
@Test
70-
@SdkSuppress(minSdkVersion = 30)
67+
@SdkSuppress(minSdkVersion = 15)
7168
public void testMinSdkVersion() {
72-
Log.d("Test Filters", "Checking for min sdk >= 30");
69+
Log.d("Test Filters", "Checking for min sdk >= 15");
7370
Activity activity = activityTestRule.getActivity();
7471
assertNotNull("MainActivity is not available", activity);
7572
}
@@ -104,7 +101,6 @@ public void testPressBackButton() {
104101
}
105102

106103
@Test
107-
@Ignore
108104
public void testUiDevice() throws RemoteException {
109105
UiDevice device = UiDevice.getInstance(
110106
InstrumentationRegistry.getInstrumentation());
@@ -114,6 +110,7 @@ public void testUiDevice() throws RemoteException {
114110
}
115111
}
116112

113+
@Ignore
117114
@Test
118115
public void testUiAutomatorAPI() throws UiObjectNotFoundException, InterruptedException {
119116
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
@@ -124,7 +121,7 @@ public void testUiAutomatorAPI() throws UiObjectNotFoundException, InterruptedEx
124121

125122
Thread.sleep(2000);
126123

127-
UiSelector buttonSelector = new UiSelector().className("android.widget.Button").text("Click Me").clickable(true);
124+
UiSelector buttonSelector = new UiSelector().className("android.widget.Button").text("CLICK ME").clickable(true);
128125
UiObject buttonWidget = device.findObject(buttonSelector);
129126
buttonWidget.click();
130127

SampleApp/app/src/androidTest/java/in/ravidsrk/sample/SampleServiceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import android.content.Intent;
44
import android.os.IBinder;
55
import android.support.test.InstrumentationRegistry;
6-
//import android.support.test.rule.ServiceTestRule;
6+
import android.support.test.rule.ServiceTestRule;
77
import android.support.test.runner.AndroidJUnit4;
88

99
import org.junit.Rule;
@@ -18,8 +18,8 @@
1818
public class SampleServiceTest {
1919

2020
@Rule
21-
//public ServiceTestRule myServiceRule = new ServiceTestRule();
22-
public SampleServiceTestRule myServiceRule = new SampleServiceTestRule();
21+
public ServiceTestRule myServiceRule = new ServiceTestRule();
22+
// public SampleServiceTestRule myServiceRule = new SampleServiceTestRule();
2323

2424
@Test
2525
public void testService() throws TimeoutException {

SampleApp/app/src/test/java/in/ravidsrk/sample/ExampleUnitTest.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

SampleApp/app/src/test/java/in/ravidsrk/sample/HamcrestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import java.util.Arrays;
66
import java.util.List;
77

8-
import static junit.framework.Assert.assertTrue;
98
import static org.hamcrest.MatcherAssert.assertThat;
109
import static org.hamcrest.Matchers.allOf;
1110
import static org.hamcrest.Matchers.greaterThan;
1211
import static org.hamcrest.Matchers.hasSize;
1312
import static org.hamcrest.core.IsCollectionContaining.hasItems;
1413
import static org.hamcrest.number.OrderingComparison.lessThan;
14+
import static org.junit.Assert.assertTrue;
1515

1616
/**
1717
* Created by Ravindra Kumar on 08/09/16.

SampleApp/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.0.0'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Mon Nov 20 21:48:38 IST 2017
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip

0 commit comments

Comments
 (0)