Giter Club home page Giter Club logo

androidtestci's Introduction

Android instrumented test with CI framework

Feature

  • Test tasks management
  • Test report generator (junit test report format compatible with Jenkins)
  • Test helper tasks

Test tasks management

  • In AndroidTestCI/app/XXXTest.gradle
  • Seperate each test task as a gradle script
  • Maintain test steps in single gradle(setup, teardown and generate report...)

Test report generator

  • Generated by ant written in AndroidTestCI/app/globalTasks.gradle
  • xml/html reports are generated in reports/ on device
  • html report format in junit-style/junit-noframes.xsl

Test helper tasks

  • In AndroidTestCI/app/globalTasks.gradle, AndroidTestCI/app/taskHelper.gradle and AndroidTestCI/app/utils.gradle
  • downloadTestAppApks, installTestApps, pushTestAppApks...
  • getGrantAppPermissionsFromFileTask, getGrantHCFSFileSystemPermTask, getGrantSmartCacheMTPFileSystemPermTask...
  • adb shell command

Environment setup: Java 8, adb, sdk, gradle, others

Device environment setup:

  • Need 'su' command by push 'su' into phone(need userdebug boot.img)

Run the test:

  • Terminal: Execute the following command to run instrumentation test on device:
cd AndroidTestCI
./gradlew XXXTest -PspecifyDevice=device_serial_num

Execute the following command to run local unit test for test program self(or use android studio):

cd test/api_test/HCFS_API_Test
./gradlew test

How to inspect test result:

  • After you run instrumented test on device, ther should be test reports in reports/

    • reports/junit-noframes.html: merge all tests into html
    • reports/TESTS-TestSuites.xml: merge all tests into xml
  • ps : html format in junit-style/

Impovement

  • test in docker (there is an adb usb connective problem in docker)
  • Rewrite with adb root

Trouble shooter

  • gradle:

    • Execution failed for task ':lintVitalRelease'. > java.lang.NullPointerException (no error message) - local.properties, which should fix this error in the cases where the NDK is not installed
    • Cannot run program "/usr/local/android-sdk-linux/build-tools/19.0.3/aapt": error=2, No such file or directory - sudo apt-get install lib32stdc++6 lib32z1
    • Incorrect JAVA_HOME setting : - Remove /usr/bin/gradle line 70
  • VirtualBox :

    1. VM 設定 USB 自動連接感應 : 步驟 : USB 接上測試手機 ->「USB設定」->「USB裝置篩選器」-> 點選右邊「+」按鈕選取該手機 -> 點選右邊「o」按鈕編輯該手機設定 -> 「遠端」值改為「任何」

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.