Jenkins shows JMeter script failure even though the script actually passed

后端 未结 2 1424
灰色年华
灰色年华 2021-01-24 12:45

I have my jmeter script running from a jenkins job but it is always reporting it as failed even though the script actually passed. I am using the \'Publish Performance test res

相关标签:
2条回答
  • 2021-01-24 12:51

    I found a way to do this! Use this plugin: https://wiki.jenkins.io/display/JENKINS/Log+Parser+Plugin

    In a rules file containing this line:
    error /FAILED/

    In the script add a beanshell Assertion for each HTTP Request that will log messages for successes and failures. Here's one example:

    String testscenario = "TEST SCENARIO: ";
    String requestName = "Find Stuff";
    String findStuff = "${MyStuff}";
    String custName = "${CustName}";
    String respData = new String(ResponseData);
    
    if (respData.contains(findStuff))
    {
        log.info(testscenario+"Passed. "+requestName+" MyStuff for Cust: " + 
    custName + " containing " + findStuff + " returned.");      
        print(testscenario+"Passed. "+requestName+" MyStuff for Customer " + 
    custName + " containing " + findStuff + " returned.");  
    } else 
    {
        log.error(testscenario+"*FAILED. "+requestName);    
        print(testscenario+"*FAILED. "+requestName);    
    }
    
    0 讨论(0)
  • 2021-01-24 12:57

    You set the threshold for Unstable/Failure to 0, so even 0 consider as failure.

    Increase the thresholds for Unstable and Failed

    0 讨论(0)
提交回复
热议问题