Skip to content

Commit 6796fec

Browse files
committed
test: add QQMusic test
1 parent 13eb0d4 commit 6796fec

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

app/src/androidTest/java/chien/com/musicunionsearch/activity/MainActivityTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package chien.com.musicunionsearch.activity;
22

3-
import android.content.SharedPreferences;
4-
import android.preference.PreferenceManager;
53
import android.support.test.InstrumentationRegistry;
64
import android.support.test.espresso.ViewAction;
75
import android.support.test.espresso.action.GeneralSwipeAction;
@@ -69,9 +67,6 @@ public void testSearch() throws InterruptedException, UiObjectNotFoundException
6967
onView(withId(android.support.v7.appcompat.R.id.search_src_text))
7068
.perform(typeText(TEST_SONG))
7169
.perform(pressKey(KeyEvent.KEYCODE_ENTER));
72-
} else if (i == 2) {
73-
//QQ音乐先忽略
74-
continue;
7570
} else {
7671
onView(withId(android.support.v7.appcompat.R.id.search_src_text))
7772
.perform(clearText())

app/src/test/java/chien/com/musicunionsearch/http/QQMusicTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.junit.After;
44
import org.junit.Assert;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76

87
import java.io.IOException;
@@ -22,11 +21,7 @@ public class QQMusicTest {
2221
private final static int testSongLen = 3;
2322
private List<QQMusicSearchSongResponse.Data.Song.SongItem> songItemList = new ArrayList<>();
2423

25-
/**
26-
* 测试搜索歌曲,因为travis-ci似乎连不到QQ音乐网络,先忽略
27-
*/
2824
@Test
29-
@Ignore
3025
public void testSearchSong() throws IOException {
3126
OkHttpClient httpClient = new OkHttpClient.Builder().build();
3227
for (String songName : TestData.SongName) {
@@ -35,7 +30,7 @@ public void testSearchSong() throws IOException {
3530
Object data = ResponseHandler.parseResponse(resp, QQMusicSearchSongResponse.class);
3631
Assert.assertNotNull(data);
3732
QQMusicSearchSongResponse songs = (QQMusicSearchSongResponse)data;
38-
Assert.assertEquals(songs.data.song.list.size(), testSongLen);
33+
Assert.assertNotEquals(songs.data.song.list.size(), 0);
3934
songItemList.addAll(songs.data.song.list);
4035
}
4136
}

0 commit comments

Comments
 (0)