Android的Maven插件:选择包要执行测试用例 [英] Android Maven Plugin: Choose packages for testcases to be executed

查看:194
本文介绍了Android的Maven插件:选择包要执行测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个詹金斯服务器上执行我的Andr​​oid应用程序与Maven的单元测试。

一切正常,但是当我想测试单元测试指定多个软件包不再执行。也许这只是我在pom.xml语法的误解?我还以为你可以为单元测试添加多个程序包。

 <&插件GT;
        <&插件GT;
            <&的groupId GT; com.jayway.maven.plugins.android.generation2< /的groupId>
            <&的artifactId GT; Android的Maven的插件< / artifactId的>
            <结构>
                <试验>
                    <&CREATEREPORT GT;真< / CREATEREPORT>
                    <套餐及GT;
<! - 只是一个包工程没有问题 - >
                        <包装及GT;&A.B.C LT; /包>
                        <包装及GT; a.b.d< /包>
                    < /包>
                < /试验>
            < /结构>
            <附加功能,GT;真< /扩展>
        < /插件>
    < /插件>


解决方案

执行程序包亚行的文件是在这里:的http://developer.android.com/tools/testing/testing_otheride.html#RunTestsCommand

要运行一个测试包中的语法是:

 亚行外壳上午仪器-w< test_package_name> /< runner_class>

我不认为有任何的方式在一个命令行运行多个测试包。因此,作为Maven插件应该是亚行的包装,我想这是不可能实现你想要什么。

您可以使用配置文件来运行不同的测试包。

I am executing unit testing of my Android App with Maven on a Jenkins server.

Everything works as expected, but when I want to specify multiple packages for testing the unit tests are not executed anymore. Maybe it's just my misunderstanding of the syntax in the pom.xml? I thought that you could add multiple packages for unit testing.

<plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <test>
                    <createReport>true</createReport>
                    <packages>
<!-- just one package works without problem -->
                        <package>a.b.c</package>
                        <package>a.b.d</package>
                    </packages>
                </test>
            </configuration>
            <extensions>true</extensions>
        </plugin>
    </plugins>

解决方案

The adb documentation for executing packages is here : http://developer.android.com/tools/testing/testing_otheride.html#RunTestsCommand

To run a single test package the syntax is :

adb shell am instrument -w <test_package_name>/<runner_class>

I don't think there is any way to run multiple test package in a single command line. So, as the maven plugin ought to be a wrapper for adb, I guess it's not possible to achieve what you want.

You may use profiles to run different test packages.

这篇关于Android的Maven插件:选择包要执行测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆