QAF: java.lang.IllegalArgumentException: 添加操作的键必须被定义

huangapple go评论74阅读模式
英文:

QAF: java.lang.IllegalArgumentException: Key for add operation must be defined

问题

环境:
QAF
Java:8
TestNG:6.10
Appium:1.18.0-1
IVY
ivy.xml
BDDTestFactory
Android设备:操作系统 9

尝试在Android设备上运行任何场景时,会抛出以下异常。在iOS设备上运行正常,以前在Android上也正常运行。

<dependencies>
    <dependency org="com.qmetry" name="qaf" rev="3.0.0-RC3"/>
    <dependency org="com.qmetry" name="qaf-support" rev="3.0.0-RC3"/>
    <dependency org="com.qmetry" name="qaf-support-ws" rev="3.0.0-RC3"/>
    <dependency org="org.aspectj" name="aspectjtools" rev="1.9.5"/>
    <dependency org="org.aspectj" name="aspectjweaver" rev="1.9.5" />
    <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"/>
    <dependency org="io.appium" name="java-client" rev="7.3.0"/>
    <dependency org="org.seleniumhq.selenium" name="selenium-java" rev="3.141.59" force="true"/>
</dependencies>

异常:

java.lang.IllegalArgumentException: Key for add operation must be defined!
	at org.apache.commons.configuration.tree.DefaultExpressionEngine.prepareAdd(DefaultExpressionEngine.java:419)
	at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(HierarchicalConfiguration.java:383)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(AbstractHierarchicalFileConfiguration.java:146)
	at com.qmetry.qaf.automation.util.PropertyUtil.addPropertyDirect(PropertyUtil.java:107)
	at org.apache.commons.configuration.AbstractConfiguration.addPropertyValues(AbstractConfiguration.java:422)
	at org.apache.commons.configuration.AbstractConfiguration.copy(AbstractConfiguration.java:1241)
	at com.qmetry.qaf.automation.util.PropertyUtil.loadFile(PropertyUtil.java:215)
	at com.qmetry.qaf.automation.util.PropertyUtil.load(PropertyUtil.java:202)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addBundle(ConfigurationManager.java:193)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addBundle(ConfigurationManager.java:160)
	at com.qmetry.qaf.automation.core.ConfigurationManager$PropertyConfigurationListener.configurationChanged(ConfigurationManager.java:418)
	at org.apache.commons.configuration.event.EventSource.fireEvent(EventSource.java:249)
	at org.apache.commons.configuration.AbstractConfiguration.copy(AbstractConfiguration.java:1247)
	at com.qmetry.qaf.automation.util.PropertyUtil.addAll(PropertyUtil.java:180)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addAll(ConfigurationManager.java:285)
	at com.qmetry.qaf.automation.testng.TestNGTestCase.setupTest(TestNGTestCase.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:144)
	at org.testng.TestRunner.beforeRun(TestRunner.java:656)
	at org.testng.TestRunner.run(TestRunner.java:624)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
	at org.testng.TestNG.runSuites(TestNG.java:1133)
	at org.testng.TestNG.run(TestNG.java:1104)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
英文:

Environment:
QAF
Java: 8
TestNG: 6.10
Appium: 1.18.0-1
IVY
ivy.xml
BDDTestFactory
Android Device: OS 9

On trying to run any scenario on Android device, it is throwing below exception. It works fine on iOS Device & this was working fine even on Android previously.

&lt;dependencies&gt;
    &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf&quot; rev=&quot;3.0.0-RC3&quot;/&gt;
    &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf-support&quot; rev=&quot;3.0.0-RC3&quot;/&gt;
    &lt;dependency org=&quot;com.qmetry&quot; name=&quot;qaf-support-ws&quot; rev=&quot;3.0.0-RC3&quot;/&gt;
    &lt;dependency org=&quot;org.aspectj&quot; name=&quot;aspectjtools&quot; rev=&quot;1.9.5&quot;/&gt;
    &lt;dependency org=&quot;org.aspectj&quot; name=&quot;aspectjweaver&quot; rev=&quot;1.9.5&quot; /&gt;
    &lt;dependency org=&quot;ant-contrib&quot; name=&quot;ant-contrib&quot; rev=&quot;1.0b3&quot;/&gt;
    &lt;dependency org=&quot;io.appium&quot; name=&quot;java-client&quot; rev=&quot;7.3.0&quot;/&gt;
    &lt;dependency org=&quot;org.seleniumhq.selenium&quot; name=&quot;selenium-java&quot; rev=&quot;3.141.59&quot; force=&quot;true&quot;/&gt;
&lt;/dependencies&gt;

Exception:

java.lang.IllegalArgumentException: Key for add operation must be defined!
	at org.apache.commons.configuration.tree.DefaultExpressionEngine.prepareAdd(DefaultExpressionEngine.java:419)
	at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(HierarchicalConfiguration.java:383)
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(AbstractHierarchicalFileConfiguration.java:146)
	at com.qmetry.qaf.automation.util.PropertyUtil.addPropertyDirect(PropertyUtil.java:107)
	at org.apache.commons.configuration.AbstractConfiguration.addPropertyValues(AbstractConfiguration.java:422)
	at org.apache.commons.configuration.AbstractConfiguration.copy(AbstractConfiguration.java:1241)
	at com.qmetry.qaf.automation.util.PropertyUtil.loadFile(PropertyUtil.java:215)
	at com.qmetry.qaf.automation.util.PropertyUtil.load(PropertyUtil.java:202)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addBundle(ConfigurationManager.java:193)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addBundle(ConfigurationManager.java:160)
	at com.qmetry.qaf.automation.core.ConfigurationManager$PropertyConfigurationListener.configurationChanged(ConfigurationManager.java:418)
	at org.apache.commons.configuration.event.EventSource.fireEvent(EventSource.java:249)
	at org.apache.commons.configuration.AbstractConfiguration.copy(AbstractConfiguration.java:1247)
	at com.qmetry.qaf.automation.util.PropertyUtil.addAll(PropertyUtil.java:180)
	at com.qmetry.qaf.automation.core.ConfigurationManager.addAll(ConfigurationManager.java:285)
	at com.qmetry.qaf.automation.testng.TestNGTestCase.setupTest(TestNGTestCase.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:144)
	at org.testng.TestRunner.beforeRun(TestRunner.java:656)
	at org.testng.TestRunner.run(TestRunner.java:624)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
	at org.testng.TestNG.runSuites(TestNG.java:1133)
	at org.testng.TestNG.run(TestNG.java:1104)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

答案1

得分: 3

这很可能是由于没有键的属性引起的。逐行检查每个属性文件,然后删除不必要的行。有时候会观察到,在合并冲突文件上检出后,会包含需要清理的冲突信息。

英文:

This is most probably because of property without key. Check your each property files line by line and remove unnecessary lines. Sometimes it observed that after checkout with merge conflict file containing conflict information that needs to be cleaned up.

huangapple
  • 本文由 发表于 2020年8月26日 14:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/63591865.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定