在Jmeter中创建动态响应断言

时间:2016-10-31 20:54:38

标签: jmeter

我正在尝试在JMeter上运行测试,我希望在响应断言中使用某种格式的文本,但它可以根据请求动态更改。我期待的反应类似于下面所示:

{
    "method": "<<Getting from the csv config file",
    "student_id": "<<getting from the csv config file>>",
    "term_id": "<<Getting from the csv Config file>>",
    "crns": [{
        "status_cd": "<<A numeric code from the response>>",
        "section": "<<N or Y from response>>",
        "message": "<<String value from response>>",
        "crn": "<<Getting from the csv config file>>"
    }]
}

我不知道如何设置我的响应断言以获得上述格式

2 个答案:

答案 0 :(得分:0)

使用JMeter检查this post以进行REST API测试。它解释了参数化+断言等。

答案 1 :(得分:0)

我认为最好将JSON Path Assertion用于JSON数据。它可以通过JMeter Plugins项目获得,只需点击几下即可使用JMeter Plugins Manager

进行安装

JSON Path Extractor

请参阅JSON Path - Getting StartedAdvanced Usage of the JSON Path Extractor in JMeter以了解如何使用JSON Path语言在JMeter中使用JSON数据