Tuesday, March 31, 2015

Robotframework Jmeter testcase example with assertion

*** Settings ***
Library           JMeterLib.py
Library           Collections

*** Test Cases ***
tc1_justRunJMeter
    run jmeter    C:/Users/USER/Desktop/apache-jmeter-2.12/apache-jmeter-2.12/bin/jmeter.bat    C:/Users/USER/Desktop/apache-jmeter-2.12/apache-jmeter-2.12/bin/vallikkv/Soap.jmx    E:/Robot/jmeter/log/output_tc1.jtl

tc2_analyseAndConvertExistingJtlLog
    ${result}    analyse Jtl convert    E:/Robot/jmeter/log/output_tc1.jtl
    log    ${result}
    : FOR    ${ELEMENT}    IN    @{result}
    \    log dictionary    ${ELEMENT}
    \    ${check}    Get From Dictionary    ${ELEMENT}    samplesSuccessRateInclAssert
    \    log to console    ${check}
    Should Be Equal As Integers    ${check}    100

tc3_runJMeterAndAnalyseAndConvertLog
    ${result}    run jmeter analyse jtl convert    C:/Users/USER/Desktop/apache-jmeter-2.12/apache-jmeter-2.12/bin/jmeter.bat    C:/Users/USER/Desktop/apache-jmeter-2.12/apache-jmeter-2.12/bin/vallikkv/Soap.jmx    E:/Robot/jmeter/log/output_tc3.jtl
    log    ${result}
    :FOR    ${ELEMENT}    IN    @{result}
    \    log dictionary    ${ELEMENT}

1 comment: