Codename One - Test Recorder: execute a test on a real device

152 views Asked by At

In the developer guide of Codename One, it's written so: «Codename One includes a built in testing framework and test recorder tool as part of the simulator. This allows developers to build both functional and unit test execution on top of Codename One. It even enables sending tests for execution on the device (pro-only feature).»

Using a pro account, what are the steps to do a test on a real device?

1

There are 1 answers

0
Shai Almog On BEST ANSWER

You need to set the build hint build.unitTest=1 which will build a version of the app that just executes the unit tests. This isn't as useful without continuous integration which is an enterprise feature...

To implement this you can do something like add a build target to your ant file:

<target name="test-for-ios-device" depends="clean,copy-ios-override,copy-libs,jar,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}"
        />
</target>

With the enterprise version you can do a synchronized build, get the result then run it on devices using appium etc. We'll come up with a guide for that soon.