Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search Ant-如何在多个文件夹中搜索文件_Search_Ant_Jenkins - Fatal编程技术网

Search Ant-如何在多个文件夹中搜索文件

Search Ant-如何在多个文件夹中搜索文件,search,ant,jenkins,Search,Ant,Jenkins,我需要编写一个脚本,在文件夹结构中搜索文件类型为.jmx的文件。例如,我将有一个名为Testing的根文件夹,其中将包含接口名称,如customer、basket、search等。然后在每个文件夹中,将有另一个名为jmxFiles的文件夹,其中将包含这些.jmx文件。 所以我需要做的是让ant搜索整个文件夹结构 我现在得到的是: <?xml version="1.0" encoding="UTF-8"?> <project default="all"> <!--

我需要编写一个脚本,在文件夹结构中搜索文件类型为.jmx的文件。例如,我将有一个名为Testing的根文件夹,其中将包含接口名称,如customer、basket、search等。然后在每个文件夹中,将有另一个名为jmxFiles的文件夹,其中将包含这些.jmx文件。 所以我需要做的是让ant搜索整个文件夹结构

我现在得到的是:

<?xml version="1.0" encoding="UTF-8"?>
<project default="all">
  <!-- Define an environment variable pointing to JMETER folder or change this -->
  <property environment="env"/>
  <property name="jmeter.save.saveservice.output_format" value="xml"/>
  <property name="jmeter-home" location="${env.JMETER_DIR}"/>
  <property name="jtesting-home" location="C:/Users/MURPHYA1/Desktop/JTesting"/>
  <!-- ant-jmeter.jar comes with jmeter, be sure this is the release you have -->
  <path id="ant.jmeter.classpath">
    <pathelement
       location="${jmeter-home}/extras/ant-jmeter-1.1.1.jar" />
  </path>
  <taskdef
    name="jmeter"
    classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"
    classpathref="ant.jmeter.classpath" />
  <target name="clean">
    <delete dir="${jtesting-home}/results"/>
    <delete file="jmeter.log"/>
    <mkdir dir="${jtesting-home}/results/jtl"/>
    <mkdir dir="${jtesting-home}/results/html"/>
  </target>
  <target name="test" depends="clean">
    <jmeter
       jmeterhome="${jtesting-home}"
       resultlogdir="${jtesting-home}/results/jtl">
      <testplans dir="JTesting" includes="**/*.jmx"/>
      <property name="jmeter.save.saveservice.output_format" value="xml"/>
      <property name="jmeter.save.saveservice.assertion_results" value="all"/>
      <property name="jmeter.save.saveservice.bytes" value="true"/>
      <property name="file_format.testlog" value="${format}"/>
      <property name="jmeter.save.saveservice.response_data.on_error" value="${funcMode}"/>
      <property name="testData.fullPath" value="C:/TestData"/>
    </jmeter>
  </target>

  <property name="lib.dir" value="${jmeter-home}/lib"/>

    <!-- Use xalan copy from JMeter lib directory to ensure consistent processing with Java 1.4+ -->
    <path id="xslt.classpath">
        <fileset dir="${lib.dir}" includes="xalan*.jar"/>
        <fileset dir="${lib.dir}" includes="serializer*.jar"/>
    </path>

  <!-- This is not needed for the plugin, but it produces a nice html report
       which can be saved usin hudson's archive artifact feature -->
  <target name="report" depends="test">
    <xslt
       classpathref="xslt.classpath"
       basedir="results/jtl"
       destdir="results/html"
       includes="*.jtl"
       style="${jmeter-home}/extras/jmeter-results-detail-report_21.xsl"/>
  </target>
  <target name="all" depends="test, report"/>
</project>

*/.jmx会工作吗?还是我需要其他东西


感谢根据JMeter文档,
testplan
元素是一个标准的Ant,因此您可以执行中描述的任何操作。单星号(
*
)是单个目录的占位符,而双星号(
***
)表示任意数量的子目录()

例如(我不确定是否正确理解了您的问题),您可以这样定义一个文件集:



这将假定目录如下:
JTesting/basket/jmxFiles/foo.jmx
。它还假设您的
${basedir}
C:/Users/MURPHYA1/Desktop
。如果不是,请为
dir
属性使用绝对路径或
${jtesting home}

这是完美的搭配。你的代码加上一个小错误的改变,它的工作魅力。非常感谢。