0
這裏是我的circleci config file:測試不合格
# Build configuration file for Circle CI
# needs to be named `circle.yml` and should be in the top level dir of the repo
general:
artifacts:
- "~/build_output.zip" # Save APK's, Lint Results, and Test Results
machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
java:
version: oraclejdk8
dependencies:
cache_directories:
- ~/.android
- ~/android
override:
- (echo "Downloading Android SDK v24...")
- (source environmentSetup.sh && getAndroidSDK)
test:
override:
# start the emulator
- emulator -avd circleci-android22 -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# unlock the emulator screen
- sleep 30
- adb shell input keyevent 82
# run tests against the emulator.
- ./gradlew connectedAndroidTest
# run jUnit tests
- ./gradlew test
# copy the build outputs to artifacts
- cp -r app/build/outputs $CIRCLE_ARTIFACTS
# copy the test results to the test results directory.
- cp -r app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS
這裏是一個test method:
@Test
public void test_ListRepos_ClickOnOneRepo_DisplayDetailWithOnlyThisRepo() {
Given:
{
final String lsOneRepoJSONData = mLocalifyClient.localify().loadRawFile(fr.guddy.androidstarter.test.R.raw.repos_octocat);
final MockResponse loMockResponseWithOneRepo = new MockResponse().setResponseCode(200);
loMockResponseWithOneRepo.setBody(lsOneRepoJSONData);
mMockWebServer.enqueue(loMockResponseWithOneRepo);
try {
mMockWebServer.start(4000);
} catch (@NonNull final Exception loException) {
loException.printStackTrace();
}
mActivity = mActivityTestRule.launchActivity(null);
}
When:
{
mSolo.clickOnText("git-consortium");
}
Then:
{
mSolo.assertCurrentActivity("should be on ActivityRepoDetail", ActivityRepoDetail.class);
final boolean lbFoundTheRepo = mSolo.waitForText("This repo is for demonstration purposes only.", 1, 5000L, true);
assertThat(lbFoundTheRepo).isTrue();
}
}
我也得到測試失敗在以下構建:https://circleci.com/gh/RoRoche/AndroidStarter/tree/master
在本地運行相同的命令,我得到以下結果:
junit.framework.AssertionFailedError:
[
GIVEN A single GitHub repo from the API
WHEN Click on its name and on the back button
THEN It should display the list
]
[
Message: Text string: 'git-consortium' is not found!
]
at junit.framework.Assert.fail(Assert.java:50)
at com.robotium.solo.Clicker.clickOnText(Clicker.java:451)
at com.robotium.solo.Solo.clickOnText(Solo.java:1502)
at fr.guddy.androidstarter.tests.ui.TestActivityRepoList.test_DetailRepos_ClickOnBack_DisplayListRepos(TestActivityRepoList.java:156)
任何想法如何配置我的circleci構建使其通過? 在此先感謝。
按照這些說明使我的構建通過:https://circleci.com/docs/oom/ –
謝謝,我已經更新了我的答案。 – FelicianoTech