代号一-使用build.unitTest = 1时需要tests.dat文件 [英] Codename One - tests.dat file needed when using build.unitTest=1

查看:71
本文介绍了代号一-使用build.unitTest = 1时需要tests.dat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个扩展AbstractTest类的测试。该测试在Netbeans中可以正常工作:我右键单击项目名称,然后单击测试。当然,Netbeans测试是在Codename One Simulator中完成的。我想在几个真实的设备上重复测试,就像我在 代号一-测试记录器:在真实设备上执行测试

I created a test extending the AbstractTest class. The test works correctly in Netbeans: I right-click on the project name, then on "Test". Of course the Netbeans test in done in the Codename One Simulator. I want to repeat the test on several real devices, as I asked in "Codename One - Test Recorder: execute a test on a real device"

所以我添加了版本.unitTest = 1 构建提示,我检查了我的build.xml是否包含:

So I added the build.unitTest=1 build hint and I checked that my build.xml contains:

<target name="test-for-ios-device" depends="clean,copy-ios-override,copy-libs,compile-test,clean-override">
    <codeNameOne 
        jarFile="${dist.jar}"
        displayName="${codename1.displayName}"
        packageName = "${codename1.packageName}"
        mainClassName = "${codename1.mainName}"
        version="${codename1.version}"
        icon="${codename1.icon}"
        vendor="${codename1.vendor}"
        subtitle="${codename1.secondaryTitle}"
        buildArgs="build.unitTest=1"
        targetType="iphone"
        certificate="${codename1.ios.debug.certificate}"
        certPassword="${codename1.ios.debug.certificatePassword}"
        provisioningProfile="${codename1.ios.debug.provision}"
        appid="${codename1.ios.appid}"
        automated="${automated}"
        />
</target>

<target name="test-for-android-device" depends="clean,copy-android-override,copy-libs,compile-test,clean-override">
    <codeNameOne 
        jarFile="${dist.jar}"
        displayName="${codename1.displayName}"
        packageName = "${codename1.packageName}"
        mainClassName = "${codename1.mainName}"
        version="${codename1.version}"
        icon="${codename1.icon}"
        vendor="${codename1.vendor}"
        subtitle="${codename1.secondaryTitle}"
        buildArgs="build.unitTest=1"
        targetType="android"
        keystoreAlias="${codename1.android.keystoreAlias}"
        keystore="${codename1.android.keystore}"
        certPassword="${codename1.android.keystorePassword}"
        automated="${automated}"
        />
</target>

此后,我发送了一个iOS版本:它无法编译。因此,我尝试发送一个Android版本。由于/tests.dat文件不存在,因此在实际设备上生成的apk会产生错误。确切的错误是:在文件中找不到测试数据,请确保ant任务已完全执行 (由 DeviceRunner类在第57行)。我在/ src中添加了一个空的tests.dat,但是它没有用,因为没有运行测试。

After that, I sent an iOS build: it doesn't compile. So I tried to send an Android build. The generated apk, on a real device, produces an error because the /tests.dat file is absent. The exact error is: "Test data not found in the file, make sure the ant task was executed in full" (it's produced by DeviceRunner class at line 57). I added an empty tests.dat in /src, but it's not useful, because no test is runned.

我不知道该怎么做。

I don't know what I have to do.

我需要分步说明,以与在Codename One Simulator中相同的方式在真实设备上测试应用程序。谢谢。

I need step-by-step instructions to test an app on a real device in the same way that I do in the Codename One Simulator. Thanks.

推荐答案

compile-test 目标中目标要求,我们有以下行:

In the compile-test target which is the base target required we have this line:

<prepareTests classesDir="${build.classes.dir}" testClassesDir="${build.test.classes.dir}" seJar="JavaSE.jar" metaDataFile="${build.test.classes.dir}/tests.dat" />

这应生成有效的 tests.dat 测试目录的文件,应该打包到构建文件中。

This should generate a valid tests.dat file for the test directory which should get packaged into the build.

这篇关于代号一-使用build.unitTest = 1时需要tests.dat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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