简体   繁体   中英

How to tell android testrunner to test external.apk insted of generated app-debug.apk?

In my test project,inside java->androidTest(com.company.xyx.test) folder I have written all the android instrumentation tests to test external.apk(not app-debug.apk), I have a separate apk with same package name of test project(com.company.xyz), what I want is when I run the test it should install external.apk and androidTest.apk to run all the tests.

Please some one tell me how to tell the test runner to run external apk or how to replace app-debug.apk from ~/output/apk/app-debug.apk to Externalapp.apk so that it should install the Externalapp.apk not app-debug

Thanks in advance..

Here is my build.gradle of app

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.tri.rec"
    testInstrumentationRunner "com.zutubi.android.junitreport.JUnitReportTestRunner"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile files('src/androidTest/java/com/tri/re/libs/android-junit-report-1.5.8.jar')
compile files('src/androidTest/java/com/tri/re/libs/robotium-solo-5.2.2-SNAPSHOT.jar')
compile files('src/androidTest/java/com/tri/re/libs/spoon-client-1.1.1.jar')
}

androidTest build.gradle

// Top-level build file where you can add configuration options common to    all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

Please some tell me how to tell the test runner to run external apk or how to replace app-debug.apk from ~/output/apk/app-debug.apk to Externalapp.apk so that it should install the Externalapp.apk

Got it

Using this spoon command you can do this

 java -jar C:\Users\Shivam\Downloads\spoon-runner-1.1.1-jar-with- dependencies.jar --apk 
 D:\Signedapks\external.apk  --test-apk
 C:\Users\Shivam\AndroidStudioProjects\TestingTool\app\build\outputs\apk\app-
debug-androidTest-unaligned.apk --sdk E:\sdk

external.apk must be signed with same keystore as debug-androidTest-unaligned.apk and package name must be same as external.apk's package name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM