使用索爱的junit框架报出解析xml“.sax.SAXParseException: 属性前要求有空白。”

supervar 2007-11-06 09:46:08
使用 mobile-ju-1.0 测试框架时在编译测试用例时报错,不知是何原因,望高手指点。



Total time: 11 seconds
D:\JavaProject\j2me\core-ri\unittest\build>ant
Buildfile: build.xml

run-javame-tests:
[java] Building midlet... 78ms
[java] Building test midlet... 141ms
[java] Uploading and running test midlet... 3s
[java] Error verifying method com/telenav/res/ResourceFactory getInstance()
Lcom/telenav/framework/res/IResourceFactory;
[java] Approximate bytecode offset 3: Inconsistent or missing stackmap at t
arget
[java] ALERT: java/lang/VerifyError: com/telenav/res/ResourceFactory.
[java] ..EDone. 7s 594ms

[java] Time: 7.594
[java] There was 1 error:
[java] 1) com.sonyericsson.sdkme.junit.OnDeviceTest@106082org.xml.sax.SAXPa
rseException: 属性前要求有空白。
[java] at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
[java] at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3364)
[java] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1
556)
[java] at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
[java] at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1
691)
[java] at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:
667)
[java] at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
[java] at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.j
ava:448)
[java] at com.sonyericsson.junit.server.Parser.parse(Parser.java:111)
[java] at com.sonyericsson.sdkme.junit.OnDeviceTest.run(Unknown Source)

[java] at com.sonyericsson.sdkme.junit.OnDeviceTest.main(Unknown Source
)

[java] FAILURES!!!
[java] Tests run: 2, Failures: 0, Errors: 1




BUILD FAILED
D:\JavaProject\j2me\core-ri\unittest\build\build.xml:30: Java returned: 1
...全文
94 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
brant_yan 2007-11-20
  • 打赏
  • 举报
回复
你能在Eclipse里面运行么。。?我现在是报读不到配置文件。就是里面的那个default-propereces.pro文件
com.sonyericsson.jtools.common.AbstractConfiguration$ConfigurationException: Could not load configuration
[java] Use switch --print-config:on to print configuration before a test run.
[java] ***
[java] at com.sonyericsson.sdkme.junit.UEIConfigurationFactory.fromProperties(Unknown Source)
[java] at com.sonyericsson.sdkme.junit.OnDeviceTest.initConfig(Unknown Source)
[java] at com.sonyericsson.sdkme.junit.OnDeviceTest.main(Unknown Source)
[java] Caused by: java.lang.IllegalArgumentException: Parameters are too nested; tried to replace parameters in '${javac}' using these parameters: {wtk=${project-dir}/../.., javac=${javac}, test-report=${test}/testreport.xml, midlet-source=${project-dir}/src, utc=1195526789843, timestamp=20071120T104629, midlet-resources=${project-dir}/res, coverage=off, jar=${test-bin}/${midlet-name}-test.jar, midlet-classes=${output-classes}/../midlet-classes, progress=TEXT, output-classes=${test-bin}/classes, print-config=on, coverage-result=${test-bin}/coverage.xml, compile=true, java.home=E:\Java\jdk5\jre, project-dir={buildLibLocation_root}\preprocess, test-bin=${test}/bin, test-classes=${test-bin}/test-classes, jad=${test-bin}/${midlet-name}-test.jad, midlet-manifest=${project-dir}/bin/MANIFEST.MF, coverage-report=${test}/coverage.html, midlet-under-test=${project-dir}/bin/${midlet-name}.jar, clean=Off, compile-midlet=true, device=SonyEricsson_W800_Emu, add-line-numbers=Off, coverage-map-file=${test-bin}/coverage.map, test-resources=${test}/res, test=${project-dir}/test, generated-tests=${test-bin}/generated-tests, midlet-name=preprocess, test-source=${test}/src}
[java]
supervar 2007-11-07
  • 打赏
  • 举报
回复
应该不是xml格式问题,因为我写了很多空的unit test 编译是没问题的,但是里面在testXXX函数里面多写点东西就出问题了。
这只是我个人的想法,也可能xml有问题,先贴出来


<project name="Mobile JUnit Sample Project" default="run-javame-tests">
<taskdef resource="antenna.properties" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<property file="./build.properties" />
<property file="./../common.properties" />
<property file="./build_root.properties" />
<property name="project-dir" location=".." />
<property name="javac" value="${jdk}/bin/javac.exe" />
<property name="app_path" value="unittest"/>
<property name="app_name" value="unittest"/>
<property name="core_dependencies" value="audio,comm-socket,data,framework,module,res,thread,trace,map,nav,route,gps,ui/tn,ui/tn-cldc,event,stops,traffic,preference,address,poi,acTemplate"/>

<path id="test-classpath" >
<fileset dir="${allproj}/${app_path}/${lib}">
<include name="*.jar" />
<include name="${build}/*.jar" />
</fileset>
</path>

<target name="clean_bin">
<echo>clean bin ...</echo>
<delete dir="${allproj}/${app_path}/test/bin/generated-tests" />
<delete dir="${allproj}/${app_path}/test/bin/test-classes" />
<delete dir="${allproj}/${app_path}/test/bin/midlet-classes" />
<delete file="${allproj}/${app_path}/test/bin/coverage.xml" />
<delete file="${allproj}/${app_path}/test/bin/unittest-test.jar" />
<delete file="${allproj}/${app_path}/test/bin/unittest-test.jad" />
</target>

<target name="run-javame-tests" depends="clean_bin">
<java classname="com.sonyericsson.sdkme.junit.OnDeviceTest"
fork="true" failonerror="true" >

<classpath refid="test-classpath" />
<arg value="--javac:${javac}" />
<arg value="--project-dir:${project-dir}" />
<arg value="--device:${device}"/>
<arg value="--wtk:${wtk}" />
<arg value="--compile:true" />
<arg value="--compile-midlet:true" />
</java>
</target>


<target name="compile-standalone" >
<java classname="com.sonyericsson.sdkme.junit.OnDeviceTest"
fork="true" failonerror="true" >
<classpath refid="test-classpath" />
<arg value="--javac:${javac}" />
<arg value="--project-dir:${project-dir}" />
<arg value="--wtk:${wtk}" />
<arg value="--jar:${project-dir}/bin/test-midlet.jar" />
<arg value="--jad:${project-dir}/bin/test-midlet.jad" />
<arg value="--device:${device}"/>
<arg value="--compile-midlet:true" />

<arg value="--runmode:COMPILE-ONLY" />

<arg value="--test-runner-class:com.sonyericsson.junit.midletrunner.StandaloneMIDlet"/>
</java>

<echo message="A standalone test MIDlet was compiled and written to ${project-dir}/bin/test-midlet.jad" />
</target>


<target name="run-with-coverage" >
<java classname="com.sonyericsson.sdkme.junit.OnDeviceTest"
fork="true" failonerror="true" >
<classpath refid="test-classpath" />
<arg value="--javac:${javac}" />
<arg value="--project-dir:${project-dir}" />
<arg value="--wtk:${wtk}" />
<arg value="--device:${device}"/>
<arg value="--compile:true" />
<arg value="--compile-midlet:true" />
<arg value="--coverage:L" />
<arg value="--coverage-report:${project-dir}/coverage.html" />
<arg value="--name:Mobile JUnit Sample Project" />
</java>

<echo message="A coverage HTML report has been written to ${project-dir}/coverage.html" />
</target>


<target name="update_all_libs">

</target>

<!-- updates dependencies -->
<target name="update_libs">
<!-- clear out current dependencies -->
<delete quiet="true" dir="${allproj}/${app_path}/test/bin/classes" />
<mkdir dir="${allproj}/${app_path}/test/bin/classes" />

<foreach
list="${core_dependencies}"
target="get_lib"
param="package"
inheritall="true"
inheritrefs="true">

<param name="lib_dir" value="${core_publish_dir}" />
</foreach>
<exec dir="${allproj}/${app_path}/${lib}" executable="${midp_home}/bin/preverify">
<arg line=" -classpath ${midp_home}/lib/midpapi20.jar;${midp_home}/lib/cldcapi11.jar;${allproj}/${app_path}/lib/jsr082.jar;${allproj}/${app_path}/lib/sprint2_1.jar;${allproj}/${app_path}/lib/net_rim_api.jar" />
<arg line=" -d ${allproj}/${app_path}/test/bin/classes"/>
<arg line=" ${allproj}/${app_path}/test/bin/classes"/>
</exec>
</target>

<target name="get_lib">
<!-- get latest libraries -->
<copy todir="${allproj}/${app_path}/test/bin/classes" >
<fileset dir="${lib_dir}/${package}/${bin}">
<include name="**/*.*" />
</fileset>
</copy>
</target>

</project>

lsj19830812 2007-11-06
  • 打赏
  • 举报
回复
程序里用到的xml贴出来吧,应该是xml格式有错

13,100

社区成员

发帖
与我相关
我的任务
社区描述
Java J2ME
社区管理员
  • J2ME社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧