Hudson Android多配置测试项目找不到测试结果 - “没有找到测试报告文件。配置错误?”

时间:2012-05-18 10:59:44

标签: android testing hudson

我有我已经集成到Hudson中的android测试项目。我创建了一个带有下一个设置的自由式软件项目: 1. 源代码管理 - 自定义工作区 2. 在构建期间运行Android模拟器: * Android OS版本:4.0.3 *屏幕密度:240 *屏幕分辨率:WVGA *设备区域设置:en_US * SD卡大小:16M 3. 调用Ant : 目标:所有干净的emma调试安装测试 构建文件:workspace / Project / build.xml 4. 构建后操作 *归档工件:** / * test-TEST.xml *发布JUnit测试结果报告:** / * test-TEST.xml *记录艾玛报道报告:** / coverage.xml *记录文件的指纹以跟踪使用情况:** / * test-TEST.xml 这是覆盖我的ant目标的build.xml文件部分:

    <!-- version-tag: custom -->
    <target name="test" depends="-test-project-check"
                description="Runs tests from the package defined in test.package property">

        <property name="tested.project.absolute.dir" location="${tested.project.dir}" />

        <property name="test.runner" value="android.test.InstrumentationTestRunner" />

        <!-- Application package of the tested project extracted from its manifest file -->
        <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
                expression="/manifest/@package" output="tested.manifest.package" />
        <xpath input="AndroidManifest.xml"
                expression="/manifest/@package" output="manifest.package" />

        <property name="emma.dump.file"
                value="/data/data/${tested.manifest.package}/coverage.ec" />

        <if condition="${emma.enabled}">
            <then>
                <echo>WARNING: Code Coverage is currently only supported on the emulator and rooted devices.</echo>
                <run-tests-helper emma.enabled="true">
                    <extra-instrument-args>
                        <arg value="-e" />
                           <arg value="coverageFile" />
                           <arg value="${emma.dump.file}" />
                    </extra-instrument-args>
                </run-tests-helper>
                <echo>Downloading coverage file into project directory...</echo>
                <exec executable="${adb}" failonerror="true">
                    <arg line="${adb.device.arg}" />
                    <arg value="pull" />
                    <arg value="${emma.dump.file}" />
                    <arg value="coverage.ec" />
                </exec>
                <echo>Extracting coverage report...</echo>
                <emma>
                    <report sourcepath="${tested.project.absolute.dir}/${source.dir}"
                                      verbosity="${verbosity}">
                        <!-- TODO: report.dir or something like should be introduced if necessary -->
                        <infileset dir=".">
                            <include name="coverage.ec" />
                            <include name="coverage.em" />
                        </infileset>
                        <!-- TODO: reports in other, indicated by user formats -->
                        <html outfile="${basedir}/coverage/coverage.html" />
                        <xml outfile="${basedir}/coverage/coverage.xml" />
                   </report>
                </emma>
                <echo>Cleaning up temporary files...</echo>
                <delete file="coverage.ec" />
                <delete file="coverage.em" />
                <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
            </then>
            <else>
                <run-tests-helper />
            </else>
        </if>
        <mkdir dir="${basedir}/junit-results" />
        <echo>Base dir is ${basedir}</echo>
        <exec executable="${adb}" failonerror="true" dir="${basedir}/junit-results">
            <arg line="${adb.device.arg}" />
            <arg value="pull" />
            <arg value="/data/data/${tested.manifest.package}/files/" />
        </exec>
    </target>    
    <import file="${sdk.dir}/tools/ant/build.xml" />

</project>

现在,这个项目工作正常,我得到emma覆盖和测试结果,但当我配置相同选项的多配置项目,除了Android模拟器我设置不同的变量与os,密度和屏幕分辨率,我得到了坚持一个错误 -

test:
     [echo] WARNING: Code Coverage is currently only supported on the emulator and rooted devices.
     [echo] Running tests ...
     [exec] 
     [exec] com.mobclix.android.externaltestharness.test.UnitActivityTest:.
     [exec] Test results for PolideaInstrumentationTestRunner=.
     [exec] Time: 25.122
     [exec] 
     [exec] OK (1 test)
     [exec] 
     [exec] 
     [exec] Generated code coverage data to /data/data/com.mobclix.android.externaltestharness/coverage.ec
     [echo] Downloading coverage file into project directory...
     [exec] 355 KB/s (2043 bytes in 0.005s)
     [echo] Extracting coverage report...
     [echo] Cleaning up temporary files...
   [delete] Deleting: /Users/biercoff/Work/Workspace/HarnessExternalTest/coverage.ec
   [delete] Deleting: /Users/biercoff/Work/Workspace/HarnessExternalTest/coverage.em
     [echo] Saving the report file in /Users/biercoff/Work/Workspace/HarnessExternalTest/coverage/coverage.html
     [echo] Base dir is /Users/biercoff/Work/Workspace/HarnessExternalTest
     [exec] pull: building file list...
     [exec] pull: /data/data/com.mobclix.android.externaltestharness/files/com.mobclix.android.externaltestharness.test-TEST.xml -> ./com.mobclix.android.externaltestharness.test-TEST.xml
     [exec] 1 file pulled. 0 files skipped.
     [exec] 40 KB/s (499 bytes in 0.012s)

BUILD SUCCESSFUL
Total time: 1 minute 20 seconds
$ /Users/biercoff/.hudson/tools/android-sdk/platform-tools/adb disconnect localhost:53830
[android] Stopping Android emulator
[android] Archiving emulator log
$ /Users/biercoff/.hudson/tools/android-sdk/platform-tools/adb kill-server
Recording fingerprints
Recording test results
No test report files were found. Configuration error?
Archiving artifacts
Description set: 
Emma: looking for coverage reports in the provided path: /Users/biercoff/Work/Workspace/HarnessExternalTest/coverage/coverage.xml
Emma: found 1 report files: 
          /Users/biercoff/Work/Workspace/HarnessExternalTest/coverage/coverage.xml
Emma: stored 1 report files in the build folder: /Users/biercoff/.hudson/jobs/MulitTestHarnessProject/configurations/axis-density/240/axis-os/4.0.3/axis-resolution/WVGA/builds/2012-05-18_17-26-05/emma
Emma: Coverage: Classes 21/39 (54%). Methods 40/128 (31%). Blocks 833/2928 (28%). Lines 154.5/528 (29%). 
[DEBUG] Skipping watched dependency update for build: MulitTestHarnessProject/density=240,os=4.0.3,resolution

对于emma覆盖,我必须将Hudson中的路径更改为/Users/biercoff/Work/Workspace/HarnessExternalTest/coverage/coverage.xml以使其正常工作, 但当我试图为Junit测试结果做同样的事情时,Hudson拒绝“看到”它。文件位于junit-results文件夹下的项目文件夹中,但每次运行新版本时,我都会得到相同的没有找到测试报告文件。配置错误?错误消息。试过很多变化,但没有运气。我想念的东西可能很小。请问有人帮帮我吗?

1 个答案:

答案 0 :(得分:1)

Hudson搜索相对于其工作空间的jUnit测试结果。并且你不能指定绝对路径(我已经使用Hudson / Jenkins超过一年但仍然不确定为什么不这样做)。因此,在您的情况下,它只查看目录级别比工作区更深的内容。现在,对于多配置项目,工作空间不是从顶层开始,而是更深层次 - 它包括轴名称(例如:workspace_root/AXIS1_NAME/AXIS1_VAL...)。但是您的测试位于该工作区的 up the directory tree 中。您必须在构建步骤中将它们复制${WORKSPACE},然后Hudson才能发布它们。