Jmeter包含控制器相对路径
我们正在使用Jmeter-maven-plugin并在eclipse中创建了一个maven项目。我的测试文件(MainTest.jmx)位于src /
test / jmeter文件夹中,在此测试中,我们使用“包含控制器”来重用测试片段。这些片段存储在src / test / jmeter /
fragments中。我们尝试在包含控制器中遵循相对路径
../fragments/FragmentA.jmx
src /测试/ jmeter /片段/FragmentA.jmx
在pom.xml中尝试使用propertiesUser选项
```
<fragments.directory>src/test/jmeter/fragments</fragments.directory></propertiesUser>
``
包括控制器无法加载.jmx文件。追随
错误oajcIncludeController:包含控制器’包含控制器’无法加载’$ {__ P(fragments.directory)} /
fragmentA.jmx’-有关详细信息,请参阅日志。
java.io.IOException:loadIncludedElements-失败:E:\ Luna \ ADXJmeter \ target \
jmeter \ bin \ $ { P(fragments.directory)} \
FragmentA.jmx
完整日志
> 2017-05-24 12:14:39,442 INFO o.a.j.c.IncludeController: loadIncludedElements -- try to load included module: E:\Luna\ADXJmeter\target\jmeter\bin\FragmentA.jmx> 2017-05-24 12:14:39,442 INFO o.a.j.c.IncludeController: loadIncludedElements -failed for: E:\Luna\ADXJmeter\target\jmeter\bin\FragmentA.jmx
> 2017-05-24 12:14:39,442 INFO o.a.j.c.IncludeController: loadIncludedElements -Attempting to read it from: E:\Luna\ADXJmeter\target\jmeter\testFiles\FragmentA.jmx
> 2017-05-24 12:14:39,442 ERROR o.a.j.c.IncludeController: Include Controller 'Include Controller' can't load 'FragmentA.jmx' - see log for details
> 2017-05-24 12:14:39,443 ERROR o.a.j.u.JMeterUtils: Including file "FragmentA.jmx" failed for Include Controller "Include Controller", unexpected error - see log for details
> 2017-05-24 12:14:39,443 WARN o.a.j.c.IncludeController: Including file "FragmentA.jmx" failed for Include Controller "Include Controller", unexpected error
> java.io.IOException: loadIncludedElements -failed for: E:\Luna\ADXJmeter\target\jmeter\bin\FragmentA.jmx and E:\Luna\ADXJmeter\target\jmeter\testFiles\FragmentA.jmx
> at org.apache.jmeter.control.IncludeController.loadIncludedElements(IncludeController.java:139) [ApacheJMeter_components-3.2.jar:3.2 r1790748]
> at org.apache.jmeter.control.IncludeController.resolveReplacementSubTree(IncludeController.java:111) [ApacheJMeter_components-3.2.jar:3.2 r1790748]
> at org.apache.jmeter.JMeter.runNonGui(JMeter.java:936) [ApacheJMeter_core-3.2.jar:3.2 r1790748]
> at org.apache.jmeter.JMeter.startNonGui(JMeter.java:910) [ApacheJMeter_core-3.2.jar:3.2 r1790748]
> at org.apache.jmeter.JMeter.start(JMeter.java:538) [ApacheJMeter_core-3.2.jar:3.2 r1790748]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
回答:
在尝试以这种方式使用“包含控制器”之前,您是否已阅读过文档?
该元素
。但是,如果定义了属性includecontroller.prefix,则使用内容作为路径名的前缀。
同一章提供了线索:您拥有includecontroller.prefix
属性,JMeter将尝试在includecontroller.prefix
+
路径下查找文件。Filename
因此,您应该修改配置,如下所示:
<propertiesUser> <includecontroller.prefix>src/test/jmeter/fragments</includecontroller.prefix>
</propertiesUser>
并仅FragmentA.jmx
在包含控制器中使用。
请查看如何使用JMeter测试片段管理大型JMeter脚本,以获取有关使用模块化JMeter测试的更多信息。
以上是 Jmeter包含控制器相对路径 的全部内容, 来源链接: utcz.com/qa/429062.html