joy460154849
joy460154849
采纳率10.7%
2018-01-02 07:15

Jenkins构建失败,没有生成jtl

5
已采纳

报错日志:
Started by user anonymous
Building on master in workspace /Users/Shared/Jenkins/Home/job/extras
[extras] $ /Users/lixiuming/Ant/bin/ant
Buildfile: /Users/Shared/Jenkins/Home/job/extras/build.xml

run:
[echo] funcMode = false
[jmeter] Executing test plan: /Users/Shared/Jenkins/Home/job/script/TestSentence1.jmx ==> /Users/Shared/Jenkins/Home/job/extras/result/Test201801020249.jtl
[jmeter] 2018-01-02 14:49:32,219 main ERROR FileManager (jmeter.log) java.io.FileNotFoundException: jmeter.log (Permission denied) java.io.FileNotFoundException: jmeter.log (Permission denied)
。。。。。。。。。。

_message_xalan:

xslt-report:

BUILD FAILED
/Users/Shared/Jenkins/Home/job/extras/build.xml:150: input file /Users/Shared/Jenkins/Home/job/extras/result/Test201801020249.jtl does not exist

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • qq_34571822 qq_34571822 3年前

    应该是存放的文件夹权限不够。尝试去换个路径

    点赞 评论 复制链接分享
  • w519084123 Perry_Lee 3年前

    楼主问题解决了吗 我遇到和你一样的问题

    点赞 评论 复制链接分享
  • qq_39806105 别动我名字 2年前

    解决方法:进入jmeter的bin目录下修改log权限执行

    [root@VM_0_4_centos /]# cd /opt/apache-jmeter-4.0/bin
    [root@VM_0_4_centos bin]# chmod 777 *.log 
    

    777就是高权限(读、写、执行) 意思就是将当前目录下所有.log文件都给予777权限

    点赞 评论 复制链接分享
  • qq_41224289 qq_41224289 3年前

    你这个不是jenkins的会员,然后你是匿名

    点赞 评论 复制链接分享
  • airfling airfling 3年前

    你是没有创建jenkins的用户吧,错误显示使用的是匿名用户

    点赞 评论 复制链接分享
  • joy460154849 joy460154849 3年前

    build.xml:
    <?xml version="1.0"?>





        Sample build file for use with ant-jmeter.jar
        See http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
    
    To run a test and create the output report:
        ant -Dtest=script
    
    To run a test only:
        ant -Dtest=script run
    
    To run report on existing test output
        ant -Dtest=script report
    
    The "script" parameter is the name of the script without the .jmx suffix.
    
    Additional options:
        -Dshow-data=y - include response data in Failure Details
        -Dtestpath=xyz - path to test file(s) (default user.dir).
                         N.B. Ant interprets relative paths against the build file
        -Djmeter.home=.. - path to JMeter home directory (defaults to parent of this build file)
        -Dreport.title="My Report" - title for html report (default is 'Load Test Results')
    </description>
    <!--user.dir 表示当前目录-->
    <property name="testpath" value="${user.dir}"/>
    <!--basedir 表示%jmeter_home% 地址-->
    <property name="jmeter.home" value="${basedir}/.."/>
    <!--测试报告的名字-->
    <property name="report.title" value="Load Test Results"/>
    
    <!-- Name of test (without .jmx) 定义测试,测试结果的名称-->
    <property name="test" value="Test"/>
    
    <!-- Should report include response data for failures? 测试报告中是否显示失败事务?value="n"表示不显示 -->
    <property name="show-data" value="n"/>
    <!--定义样式版本-->
    <property name="format" value="2.1"/>
    <!--定义jmeter脚本存放目录,指向%JMETER_HOME%/result-->
    <property name="jmeter.result" value="${jmeter.home}/result"/>
    <property name="script.dir" value="${jmeter.home}/script"/>
    <property name="jmeter.result.jtlName" value="${jmeter.home}/extras/result/${test}${time}.jtl" />
    <property name="jmeter.result.htmlName" value="${jmeter.home}/extras/result/${test}${time}.html" />
    <property name="jmeter.jenkins" value="/Users/Shared/Jenkins/Home/workspace/TestSentence1"/>
    <condition property="style_version" value="_21">
        <equals arg1="${format}" arg2="2.1"/>
    </condition>
    
    <condition property="funcMode">
        <equals arg1="${show-data}" arg2="y"/>
    </condition>
    
    <condition property="funcMode" value="false">
      <not>
        <equals arg1="${show-data}" arg2="y"/>
      </not>
    </condition>
    
    <!-- Allow jar to be picked up locally 定义依赖包-->
    <path id="jmeter.classpath">
        <!--这里的basedir 指的是 build.xml的目录-->
        <fileset dir="${basedir}">
            <!--把ant-jmeter开头的.jar包引入进来-->
          <include name="ant-jmeter*.jar"/>
        </fileset>
    </path>
    
    <taskdef
        name="jmeter"
        classpathref="jmeter.classpath"
        classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
    <!--定义任务,一个是run,即运行脚本,一个report,即生成报告-->
    <target name="all" depends="run,report"/>
    
    <!--定义run-->
    <target name="run">
        <echo>funcMode = ${funcMode}</echo>
        <!--删除前一次测试报告,HTML格式的,${test}的变量值-->
    
        <!--resultlog测试结果保存目录-->
        <jmeter
            jmeterhome="${jmeter.home}"
            resultlog="${jmeter.result.jtlName}">
            <!--指定测试脚本或者测试脚本所在目录-->
            <!--如果是单一脚本,名称是TestSentence1.jmx-->
            <testplans dir="${script.dir}" includes="TestSentence1.jmx"/>
        <!--
            <jvmarg value="-Xincgc"/>
            <jvmarg value="-Xmx128m"/>
            <jvmarg value="-Dproperty=value"/>
            <jmeterarg value="-qextra.properties"/>
        -->
            <!-- Force suitable defaults -->
            <!--暂且定义为xml格式,后续会变成文本格式-->
            <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}"/>
            <!--是否定义错误信息,取决于${funcMode}-->
            <property name="jmeter.save.saveservice.response_data.on_error" value="${funcMode}"/>
        </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>
    
    <!--定义report任务,此任务依赖于xslt-report,copy-images这两个任务-->
    <!--xslt-report作用:把xslt转换成html-->
    <!--copy-images作用:copy图片,xslt模板中图片由他来copy到目录-->
    <target name="report" depends="xslt-report,copy-images">
        <echo>Report generated at ${report.datestamp}</echo>
    </target>
    <!--_message_xalan被xslt-report依赖,由它生成报告-->
    <target name="xslt-report" depends="_message_xalan">
        <tstamp><format property="report.datestamp" pattern="yyyy/MM/dd HH:mm"/></tstamp>
        <!--in测试结果作为输入-->
        <!--style xstl模板地址-->
        <xslt
            classpathref="xslt.classpath"
            force="true"
            in="${jmeter.result.jtlName}"
            out="${jmeter.result.htmlName}"
            style="${basedir}/jmeter-results-detail-report${style_version}.xsl">
            <param name="showData" expression="${show-data}"/>
            <param name="titleReport" expression="${report.title}"/>
            <param name="dateReport" expression="${report.datestamp}"/>
        </xslt>
    </target>
    
    
    <!-- Copy report images if needed 生成html报告需要拷贝图标到报告目录  expand.png展开图标,collapse.png收起图标-->
    <target name="copy-images" depends="verify-images" unless="samepath">
        <copy file="${basedir}/expand.png" tofile="${jmeter.home}/result/expand.png"/>
        <copy file="${basedir}/collapse.png" tofile="${jmeter.home}/result/collapse.png"/>
    </target>
    
    <!--判断${testpath}和${basedir}是否是相同-->
    <target name="verify-images">
        <condition property="samepath">
                <equals arg1="${jmeter.home}" arg2="${basedir}" />
        </condition>
    </target>
    
    <!-- Check that the xalan libraries are present 检查依赖-->
    <condition property="xalan.present">
          <and>
              <!-- No need to check all jars; just check a few -->
            <available classpathref="xslt.classpath" classname="org.apache.xalan.processor.TransformerFactoryImpl"/>
            <available classpathref="xslt.classpath" classname="org.apache.xml.serializer.ExtendedContentHandler"/>
          </and>
    </condition>
    
    <target name="_message_xalan" unless="xalan.present">
          <echo>Cannot find all xalan and/or serialiser jars</echo>
        <echo>The XSLT formatting may not work correctly.</echo>
        <echo>Check you have xalan and serializer jars in ${lib.dir}</echo>
    </target>
    

    点赞 评论 复制链接分享

相关推荐