Skip to content

Commit 857d4de

Browse files
author
yangsen
committed
update test case lib
1 parent 2d98a2a commit 857d4de

13 files changed

+31
-21
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
google()
1010
}
1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.4'
12+
classpath 'com.android.tools.build:gradle:3.6.4'
1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files
1515
}

gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
android.useAndroidX=true
2+
13
VERSION_NAME=
24
VERSION_CODE=
35
GROUP=com.qiniu
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Jun 28 14:50:04 CST 2021
1+
#Thu Jul 28 11:54:47 CST 2022
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
6+
zipStoreBase=GRADLE_USER_HOME

library/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ android {
2828
targetSdkVersion 30
2929
versionCode code
3030
versionName version
31+
32+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3133
}
3234

3335
buildTypes {

library/src/androidTest/java/com/qiniu/android/BaseTest.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44

55
import androidx.test.core.app.ApplicationProvider;
66
import androidx.test.ext.junit.runners.AndroidJUnit4;
7-
import androidx.test.platform.app.InstrumentationRegistry;
8-
9-
import com.qiniu.android.transaction.TransactionManager;
10-
11-
import junit.framework.TestCase;
127

138
import org.junit.Assert;
149
import org.junit.Before;
@@ -21,12 +16,11 @@
2116
/**
2217
* Created by yangsen on 2020/5/26
2318
*/
24-
//@RunWith(AndroidJUnit4.class)
2519
public class BaseTest {
2620

2721
private long maxWaitTimestamp = 0;
2822

29-
private Context context;
23+
private Context context = ApplicationProvider.getApplicationContext();
3024

3125
@Before
3226
public void setUp() throws Exception {

library/src/androidTest/java/com/qiniu/android/collect/UplogTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
import com.qiniu.android.TestConfig;
66
import com.qiniu.android.BaseTest;
77

8+
import org.junit.Test;
89
import org.junit.runner.RunWith;
910

1011
@RunWith(AndroidJUnit4.class)
1112
public class UplogTest extends BaseTest {
1213

14+
@Test
15+
public void test() {
16+
}
17+
1318
private void no_testUplog() {
1419
ReportItem item = new ReportItem();
1520
item.setReport(ReportItem.LogTypeRequest, ReportItem.RequestKeyLogType);

library/src/androidTest/java/com/qiniu/android/http/HttpHeaderTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class HttpHeaderTest {
1919
private Headers headers;
2020

2121
@Before
22-
protected void setUp() throws Exception {
22+
public void setUp() throws Exception {
2323

2424
HashMap<String, String> keyVaules = new HashMap<>();
2525
keyVaules.put("date", "2020-07-15 07:40:01");

library/src/androidTest/java/com/qiniu/android/http/dns/DnsApiTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public boolean shouldWait() {
4848
assertTrue(addressList.size() > 0);
4949
}
5050

51-
@Test
52-
public void testRecover(){
51+
private void testRecover(){
5352
final String host = "uplog.qbox.me";
5453

5554
final DnsPrefetcher dnsPrefetcher = DnsPrefetcher.getInstance();

library/src/androidTest/java/com/qiniu/android/http/dns/DnsTransactionTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.qiniu.android.BaseTest;
99
import com.qiniu.android.storage.UpToken;
1010

11+
import org.junit.Test;
1112
import org.junit.runner.RunWith;
1213

1314

@@ -21,6 +22,7 @@ public class DnsTransactionTest extends BaseTest {
2122
private int completeCount = 0;
2223
private int successCount = 0;
2324

25+
@Test
2426
public void testLocalLoad(){
2527

2628
completeCount = 0;
@@ -54,7 +56,7 @@ public boolean shouldWait() {
5456
assertTrue(successCount < 2);
5557
}
5658

57-
59+
@Test
5860
public void test_CheckAndPrefetch(){
5961

6062
completeCount = 0;
@@ -91,7 +93,7 @@ public boolean shouldWait() {
9193
assertTrue("successCount:" + successCount, successCount < 3);
9294
}
9395

94-
96+
@Test
9597
public void testCheckWhetherCachedValid(){
9698

9799
completeCount = 0;

library/src/androidTest/java/com/qiniu/android/storage/UploadBaseTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import java.io.InputStream;
2323
import java.io.RandomAccessFile;
2424

25-
//@RunWith(AndroidJUnit4.class)
2625
public class UploadBaseTest extends BaseTest {
2726

28-
@Override @Before
27+
@Override
28+
@Before
2929
public void setUp() throws Exception {
3030
LogUtil.enableLog(true);
3131
LogUtil.setLogLevel(Log.VERBOSE);

library/src/androidTest/java/com/qiniu/android/storage/UploadFlowTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
import java.io.InputStream;
2323
import java.util.ArrayList;
2424

25-
//@RunWith(AndroidJUnit4.class)
2625
public class UploadFlowTest extends UploadBaseTest {
2726

27+
public void test() {
28+
}
29+
2830
protected void cancelTest(long cancelPosition,
2931
File file,
3032
String key,

library/src/androidTest/java/com/qiniu/android/storage/UriTest.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public class UriTest extends BaseTest {
4444
{false, false, false},
4545
};
4646

47+
public void test() {
48+
}
49+
4750
private void notestUpload() {
4851
int MB = 1024;
4952
int[] sizeList = {512, MB, 4*MB, 5*MB, 8*MB, 10*MB, 20*MB};
@@ -74,8 +77,8 @@ private void notestUpload() {
7477
}
7578

7679

77-
@Test
78-
public void testUpload() {
80+
81+
private void testUpload() {
7982
String uriString = "content://media/external/images/media/12045";
8083
Uri uri = Uri.parse(uriString);
8184
testUpload(uri, "uri_test", "AAAA", true, false, false);

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
rootProject.name = "android-sdk"
12
include ':library'

0 commit comments

Comments
 (0)