这个问题和前面的有关系:Codename One - Test Recorder:在真实设备上执行一个测试,使用build.unitTest=1时需要Codename One - tests.dat文件
我的“test-for-ios-devi”和“test-for-android-devi”ant任务会生成不运行任何测试的IPA和APK(实际上构建服务器会生成一个. bin文件,我将其重命名为. ipa)。相反,我的测试在Codename One Simulator中正常工作。测试并不琐碎,所有日志加上一个屏幕截图都会在测试期间自动通过电子邮件发送给我(使用模拟器),我通过电子邮件收到报告没有问题。相反,在真实设备上什么都不会发生。
我报告构建。xml(我在本副本中删除了一些iRilevant任务)和三星Galaxy S6和iPhone 8的日志。
<?xml version="1.0" encoding="UTF-8"?>
<!--build_version=3.7-->
<!--
This build script was generated by Codename One to build native mobile applications using Java.
To learn more about Codename One go to https://www.codenameone.com/
-->
<project name="Myapp" default="default" basedir=".">
<description>Builds, tests, and runs the project Myapp.</description>
<import file="nbproject/build-impl.xml"/>
<property file="codenameone_settings.properties"/>
<property name="automated" value="false" />
<taskdef name="codeNameOne" classname="com.codename1.build.client.CodeNameOneBuildTask" classpath="CodeNameOneBuildClient.jar"/>
<taskdef name="prepareTests" classname="com.codename1.build.client.PrepareTestsTask" classpath="CodeNameOneBuildClient.jar"/>
<taskdef name="installLibs" classname="com.codename1.build.client.InstallLibsTask" classpath="CodeNameOneBuildClient.jar"/>
<taskdef name="verifyDir" classname="com.codename1.build.client.VerifyDir" classpath="CodeNameOneBuildClient.jar"/>
<taskdef name="generateGuiSources" classname="com.codename1.build.client.GenerateGuiSources" classpath="CodeNameOneBuildClient.jar"/>
<taskdef name="initOfflineBuilder" classname="com.codename1.build.client.InitOfflineBuilder" classpath="CodeNameOneBuildClient.jar"/>
<target depends="init,compile,jar" name="compile-test">
<mkdir dir="${build.test.classes.dir}" />
<mkdir dir="${test.src.dir}" />
<javac destdir="${build.test.classes.dir}"
encoding="${source.encoding}"
source="1.8"
target="1.8"
bootclasspath="CLDC11.jar" excludes="${excludes}"
classpath="${javac.classpath}:${build.classes.dir}">
<src path="${test.src.dir}"/>
</javac>
<prepareTests classesDir="${build.classes.dir}" testClassesDir="${build.test.classes.dir}" seJar="JavaSE.jar" metaDataFile="${build.test.classes.dir}/tests.dat" />
<jar jarfile="dist/unitTests.jar">
<fileset dir="${build.classes.dir}"/>
<fileset dir="${build.test.classes.dir}"/>
<fileset dir="lib/impl/cls"/>
</jar>
</target>
<target depends="compile-test" name="-do-test-run">
<!-- JavaSE.jar is added here since the test execution might fail otherwise for a pre-existing project -->
<java classpath="dist/unitTests.jar:${javac.test.classpath}:${file.reference.JavaSE.jar}" classname="com.codename1.impl.javase.TestRunner" fork="true">
<arg value="${codename1.packageName}.${codename1.mainName}" />
</java>
</target>
<target depends="-do-test-run" description="Run unit tests." name="test"/>
<target name="-pre-compile">
<echo>Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
code size and wider device support</echo>
<mkdir dir="build/tmp"/>
<javac destdir="build/tmp"
encoding="${source.encoding}"
source="1.8"
target="1.8"
bootclasspath="lib/CLDC11.jar" excludes="${excludes}"
classpath="${javac.classpath}:${build.classes.dir}">
<src path="${src.dir}"/>
</javac>
</target>
<target name="-post-compile">
<delete>
<fileset dir="${build.classes.dir}" includes="**/package-info.class"/>
</delete>
<delete>
<fileset dir="${build.classes.dir}" includes="**/package-info.class"/>
</delete>
<delete>
<fileset dir="${build.classes.dir}" includes="**/Thumbs.db"/>
</delete>
</target>
<target name="build-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}"
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-ios-device" depends="clean,copy-ios-override,copy-libs,compile-test,clean-override">
<codeNameOne
jarFile="dist/unitTests.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/unitTests.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>
<target name="build-for-ios-device-release" 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}"
appStoreBuild="true"
production="true"
targetType="iphone"
certificate="${codename1.ios.release.certificate}"
certPassword="${codename1.ios.release.certificatePassword}"
provisioningProfile="${codename1.ios.release.provision}"
appid="${codename1.ios.appid}"
automated="${automated}"
/>
</target>
<target name="copy-libs" depends="init">
<copy todir="${build.classes.dir}">
<fileset dir="lib/impl/cls" />
</copy>
</target>
<target name="copy-android-override">
<mkdir dir="${build.classes.dir}" />
<mkdir dir="override" />
<copy todir="${build.classes.dir}">
<fileset dir="override" includes="**/*_android.ovr"/>
<fileset dir="override" includes="**/*_android-phone.ovr"/>
<fileset dir="override" includes="**/*_android-tab.ovr"/>
<fileset dir="override" includes="**/*_phone.ovr"/>
<fileset dir="override" includes="**/*_tablet.ovr"/>
</copy>
<copy todir="${build.classes.dir}">
<fileset dir="native/android" includes="**/*"/>
<fileset dir="lib/impl/native/android" includes="**/*"/>
</copy>
</target>
<target name="copy-ios-override">
<mkdir dir="${build.classes.dir}" />
<mkdir dir="override" />
<copy todir="${build.classes.dir}">
<fileset dir="override" includes="**/*_ios.ovr"/>
<fileset dir="override" includes="**/*_iphone.ovr"/>
<fileset dir="override" includes="**/*_ipad.ovr"/>
<fileset dir="override" includes="**/*_phone.ovr"/>
<fileset dir="override" includes="**/*_tablet.ovr"/>
</copy>
<copy todir="${build.classes.dir}">
<fileset dir="native/ios" includes="**/*"/>
<fileset dir="lib/impl/native/ios" includes="**/*"/>
</copy>
</target>
<target name="clean-override">
<delete>
<fileset dir="${build.classes.dir}" includes="**/*.ovr"/>
<fileset dir="${build.classes.dir}" includes="**/*.java"/>
<fileset dir="${build.classes.dir}" includes="**/*.m"/>
<fileset dir="${build.classes.dir}" includes="**/*.h"/>
</delete>
</target>
<target name="build-for-android-device" depends="clean,copy-android-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}"
targetType="android"
keystoreAlias="${codename1.android.keystoreAlias}"
keystore="${codename1.android.keystore}"
certPassword="${codename1.android.keystorePassword}"
automated="${automated}"
/>
</target>
<target name="-pre-init">
<property name="application.args" value="${codename1.packageName}.${codename1.mainName}"/>
<property name="javac.source" value="1.8" />
<property name="javac.target" value="1.8" />
<mkdir dir="native/javase" />
<mkdir dir="native/android" />
<mkdir dir="native/internal_tmp" />
<mkdir dir="native/ios" />
<mkdir dir="native/j2me" />
<mkdir dir="native/rim" />
<mkdir dir="native/win" />
<mkdir dir="native/javascript" />
<mkdir dir="lib/impl/cls" />
<mkdir dir="lib/impl/stubs" />
<mkdir dir="lib/impl/native" />
<mkdir dir="lib/impl/native/android" />
<mkdir dir="lib/impl/native/ios" />
<mkdir dir="lib/impl/native/j2me" />
<mkdir dir="lib/impl/native/rim" />
<mkdir dir="lib/impl/native/win" />
<mkdir dir="lib/impl/native/javascript" />
<installLibs lib="lib" dest="lib/impl" />
<generateGuiSources srcDir="src" encoding="UTF-8" guiDir="res/guibuilder" />
</target>
<target name="-post-jar">
<mkdir dir="native/javase" />
<mkdir dir="native/internal_tmp" />
<mkdir dir="lib/impl/native/javase" />
<javac destdir="native/internal_tmp"
encoding="${source.encoding}"
source="1.8"
target="1.8"
bootclasspath="CLDC11.jar" excludes="${excludes}"
classpath="${javac.classpath}:${build.classes.dir}">
<src path="native/javase"/>
<src path="lib/impl/native/javase"/>
</javac>
</target>
<target name="-post-clean" depends="refresh-libs-impl">
</target>
<target name="refresh-libs" depends="refresh-libs-impl,jar">
</target>
<target name="refresh-libs-impl">
<delete dir="lib/impl" />
<installLibs lib="lib" dest="lib/impl" />
</target>
</project>
三星Galaxy S6(仅日志的相关部分):
-----STARTING TESTS-----
> 12-08 13:19:05.751 D/Myapp( 6834): [EDT] 0:0:0,10 - Failed to create instance of cool.myapp.app.tests.LoginPageTest
> 12-08 13:19:05.751 D/Myapp( 6834): [EDT] 0:0:0,10 - Verify the class is public and doesn't have a specialized constructor
> 12-08 13:19:05.751 D/Myapp( 6834): [EDT] 0:0:0,11 - Exception: java.lang.ClassNotFoundException - cool.myapp.app.tests.LoginPageTest
> 12-08 13:19:05.751 W/System.err( 6834): java.lang.ClassNotFoundException: cool.myapp.app.tests.LoginPageTest
请注意,LoginPageTest是公共的,没有我定义的任何构造函数。
苹果手机 8:
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(libAccessibility.dylib)[35170] <Notice>: Retrieving resting unlock: 0
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(FrontBoardServices)[35170] <Notice>: [FBDisplayManager=0x1d404b1f0] silently connecting <FBSDisplayConfiguration: 0x1d4177e80; Main; mode: "375x667@2x 60Hz p3"> {
> CADisplay.name = LCD;
> CADisplay.deviceName = primary;
> CADisplay.seed = 2;
> tags = 0;
> currentMode = <FBSDisplayMode: 0x1d4268140; 375x667@2x (750x1334/2) 60Hz p3>;
> safeOverscanRatio = {0.89999997615814209, 0.89999997615814209};
> nativeCenter = {375, 667};
> pixelSize = {750, 1334};
> bounds = {{0, 0}, {375, 667}};
> CADisplay = <CADisplay:LCD primary>;
> }
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(UserNotifications)[35170] <Notice>: [cool.myapp.app] Setting badge number to 0
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(UserNotifications)[35170] <Notice>: [cool.myapp.app] Set badge number [ hasCompletionHandler: 0 hasError: 0 ]
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(HangTracer)[35170] <Notice>: refreshPreferences: HangTracerEnabled: 0
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(HangTracer)[35170] <Notice>: refreshPreferences: HangTracerDuration: 500
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(HangTracer)[35170] <Notice>: refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(UserNotifications)[35170] <Notice>: [cool.myapp.app] Setting badge number to 0
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(UserNotifications)[35170] <Notice>: [cool.myapp.app] Set badge number [ hasCompletionHandler: 0 hasError: 0 ]
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(CoreGraphics)[35170] <Error>: CGContextSetAllowsAntialiasing: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
> Dec 8 13:26:35 iPhone CodenameOneUnitTestExecutor(UIAccessibility)[35170] <Notice>: loading ax info now. wasCoalesced: 1
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC Enabling TLS [1:0x1d4366840]
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TCP Conn Start [1:0x1d4366840]
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Task <1F77BFCA-1D0F-42ED-BAE8-4E0A54D579F7>.<0> setting up Connection 1
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Sending CFNA PAC query
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Received CFNA PAC response
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TCP Conn Connected [1:0x1d4366840]: Err(16)
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TCP Conn Event [1:0x1d4366840]: 1
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC Enabling TLS [1:0x1d4366840]
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 1, Pending(0)
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(UIAccessibility)[35170] <Notice>: loading ax info now. wasCoalesced: 1
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 2, Pending(0)
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(libboringssl.dylib)[35170] <Error>: Function boringssl_context_get_peer_sct_list: line 1754 received sct extension length is less than sct data length
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 11, Pending(0)
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 12, Pending(0)
> Dec 8 13:26:36 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 14, Pending(0)
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Trust Result [1:0x1d4366840]: 0
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Event [1:0x1d4366840]: 20, Pending(0)
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TCP Conn Event [1:0x1d4366840]: 8
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: TIC TLS Handshake Complete [1:0x1d4366840]
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Task <1F77BFCA-1D0F-42ED-BAE8-4E0A54D579F7>.<0> now using Connection 1
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Task <1F77BFCA-1D0F-42ED-BAE8-4E0A54D579F7>.<0> sent request, body N
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Task <1F77BFCA-1D0F-42ED-BAE8-4E0A54D579F7>.<0> received response, status 200 content K
> Dec 8 13:26:37 iPhone CodenameOneUnitTestExecutor(CFNetwork)[35170] <Notice>: Task <1F77BFCA-1D0F-42ED-BAE8-4E0A54D579F7>.<0> response ended
谢谢你,谢伊。经过大量尝试,试图找出我报告的问题的原因,我终于找到了一个“解决方案”,即在Windows 8而不是Linux Mint 18.2上运行ios设备测试和android设备测试。
好吧,这不是一个真正的“解决方案”,而是我找到的唯一方法。在Windowshtml" target="_blank">虚拟机和Linux虚拟机上,我拥有完全相同版本的jdk、相同版本的Netbeans及其插件、相同的项目和相同的构建。xml和相同的代码。但如果我在Linux上运行ios设备测试和android设备测试,我会从您的构建服务器获得无法使用的apk和ipa,相反,如果我在Windows上运行它们,结果很好。
注意,这并不总是正确的:这个问题并不是对所有项目都是可重复的,这意味着有时在Linux上运行test-for-ios-device和test-for-android-device可以很好地工作。
我刚刚发送了iOS的测试版本,并得到了一个正确的IPA。
我通过转到netbeans的文件部分,展开<code>构建来发送它。xml文件,然后选择目标,然后单击“运行目标”:
我甚至得到了“包含源”,它可以让我调试单元测试的输出。
我建议检查单元测试是否被正确打包到应用程序的单元测试容器中。这是我对iOS设备目标的测试,看起来和你的一样:
<target name="test-for-ios-device" depends="clean,copy-ios-override,copy-libs,compile-test,clean-override">
<codeNameOne
jarFile="dist/unitTests.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 depends="init,compile,jar" name="compile-test">
<mkdir dir="${build.test.classes.dir}" />
<mkdir dir="${test.src.dir}" />
<javac destdir="${build.test.classes.dir}"
encoding="${source.encoding}"
source="1.8"
target="1.8"
bootclasspath="CLDC11.jar" excludes="${excludes}"
classpath="${javac.classpath}:${build.classes.dir}">
<src path="${test.src.dir}"/>
</javac>
<prepareTests classesDir="${build.classes.dir}" testClassesDir="${build.test.classes.dir}" seJar="JavaSE.jar" metaDataFile="${build.test.classes.dir}/tests.dat" />
<jar jarfile="dist/unitTests.jar">
<fileset dir="${build.classes.dir}"/>
<fileset dir="${build.test.classes.dir}"/>
<fileset dir="lib/impl/cls"/>
</jar>
</target>
我试图设置一个android虚拟设备来测试与的同步。我遵循以下步骤: 问题是同步根本不起作用,但没有连接错误之类的错误。。。 在我看来,问题是虚拟设备只有一个私有IP,所以服务器永远不能向它发送任何东西? 所以我可能需要某种转发,比如: 但我不确定这是否正确,也不确定应该转发哪些端口。 这里是logcat,当我想同步:
我试图将iOS XCTest设置为在AWS设备场上运行,但似乎无论我如何构建和上传它们,每次测试都会出错并失败。当我运行XCode时,它们会成功执行,但不会在AWS设备场上运行。 我甚至尝试了从非常简单的应用程序,没有任何api调用,但也失败了。 以下是AWS设备场界面中出现的错误。 你可以从这里看到日志
我正在尝试测试一个Android应用程序,并通过USB连接一个设备。该设备检测到USB连接(并充电),但我似乎在计算机(运行Windows 7)上找不到该设备已连接的任何记录。我查看了设备管理器,没有看到“Android设备”类别,也没有看到“其他设备”类别。我查看了设备制造商的网站,看看他们是否有司机;我找不到。有人知道我怎样才能让设备显示在电脑上吗?谢谢
创建产品和测试设备 一、创建RGB智能灯产品 二、创建测试设备 创建产品和测试设备 更新时间:2018-06-29 23:40:34 一、创建RGB智能灯产品 从项目控制台左侧的设备菜单项里找到“产品开发”,点击进入并点击“立即创建产品”。 按下图填写表单,所属分类选择“智能生活/电工照明/灯”,节点类型选择“设备”,通讯网络选择“Wi-Fi”,数据格式选择“Alink”,然后点“提交”后点击“进
我想使用Appium在多个iOS设备上并行运行我的自动化脚本。我可以在Android系统上执行这个并行测试,但不能在iOS上。 我们有没有办法在iOS上执行此操作。 我使用的工具有:SeleniumGrid、Appium和TestNG框架。
问题内容: 我想知道是否有可能检测浏览器是否在iOS上运行,这与使用Modernizr进行功能检测的方式类似(尽管这显然是设备检测而非功能检测)。 通常,我宁愿使用功能检测,但我需要根据该问题确定设备是否为iOS,因为它们处理视频的方式YouTube API无法在iPad / iPhone/非Flash设备上使用 问题答案: 我不喜欢User Agent嗅探,但是这是你的处理方式: 另一种方法是依