Jmeter 包含控制器相对路径
Jmeter include controller relative path
我们正在使用 Jmeter-maven-plugin 并在 eclipse 中创建了一个 maven 项目。我的测试文件 (MainTest.jmx) 在 src/test/jmeter 文件夹中,在这个测试中我们使用 "include controller" 来重用测试片段。这些片段存储在 src/test/jmeter/fragments 中。我们尝试在包含控制器
中遵循相对路径
../fragments/FragmentA.jmx
src/test/jmeter/fragments/FragmentA.jmx
已尝试 pom.xml
中的属性用户选项
<propertiesUser>
<fragments.directory>src/test/jmeter/fragments</fragments.directory>
</propertiesUser>
包括无法加载 .jmx 文件的控制器。获得关注
ERROR
o.a.j.c.IncludeController: Include Controller 'Include Controller'
can't load '${__P(fragments.directory)}/fragmentA.jmx' - see log for
details.
java.io.IOException: loadIncludedElements -failed for:
E:\Luna\ADXJmeter\target\jmeter\bin${__P(fragments.directory)}\FragmentA.jmx and E:\Luna\ADXJmeter\target\jmeter\testFiles${__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]
在尝试以这种方式使用 Include Controller 之前,您是否阅读过 documentation?
This element does not support variables/functions in the filename field.
However, if the property includecontroller.prefix is defined, the contents are used to prefix the pathname.
同一章提供了线索:你有 includecontroller.prefix
属性 并且 JMeter 将尝试在 includecontroller.prefix
+ Filename
[=18 的路径下查找文件=]
所以你应该修改你的配置如下:
<propertiesUser>
<includecontroller.prefix>src/test/jmeter/fragments</includecontroller.prefix>
</propertiesUser>
并且仅在包含控制器中使用 FragmentA.jmx
。
查看 How to Manage Large JMeter Scripts With JMeter Test Fragments 以获取有关使用模块化 JMeter 测试的更多信息。
我们正在使用 Jmeter-maven-plugin 并在 eclipse 中创建了一个 maven 项目。我的测试文件 (MainTest.jmx) 在 src/test/jmeter 文件夹中,在这个测试中我们使用 "include controller" 来重用测试片段。这些片段存储在 src/test/jmeter/fragments 中。我们尝试在包含控制器
中遵循相对路径../fragments/FragmentA.jmx
src/test/jmeter/fragments/FragmentA.jmx
已尝试 pom.xml
中的属性用户选项
<propertiesUser>
<fragments.directory>src/test/jmeter/fragments</fragments.directory>
</propertiesUser>
包括无法加载 .jmx 文件的控制器。获得关注
ERROR o.a.j.c.IncludeController: Include Controller 'Include Controller' can't load '${__P(fragments.directory)}/fragmentA.jmx' - see log for details.
java.io.IOException: loadIncludedElements -failed for: E:\Luna\ADXJmeter\target\jmeter\bin${__P(fragments.directory)}\FragmentA.jmx and E:\Luna\ADXJmeter\target\jmeter\testFiles${__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]
在尝试以这种方式使用 Include Controller 之前,您是否阅读过 documentation?
This element does not support variables/functions in the filename field. However, if the property includecontroller.prefix is defined, the contents are used to prefix the pathname.
同一章提供了线索:你有 includecontroller.prefix
属性 并且 JMeter 将尝试在 includecontroller.prefix
+ Filename
[=18 的路径下查找文件=]
所以你应该修改你的配置如下:
<propertiesUser>
<includecontroller.prefix>src/test/jmeter/fragments</includecontroller.prefix>
</propertiesUser>
并且仅在包含控制器中使用 FragmentA.jmx
。
查看 How to Manage Large JMeter Scripts With JMeter Test Fragments 以获取有关使用模块化 JMeter 测试的更多信息。