当前位置:网站首页>How to implement the association between interfaces in JMeter?

How to implement the association between interfaces in JMeter?

2022-06-10 14:21:00 Field test record

Hello, everyone , I'm Daejeon .

There are many ways to associate , Share two of them that are often used in the field : Regular expression extractors and  json Extractor .

First we need to know , What does association mean ?

The two interfaces are related , The response data of the previous interface is passed into the request of the next interface as a parameter .

such as : After a payment interface request is completed , You want to use the query interface to query the specific information of this order , that , You need to transfer the order data generated in the payment interface to the request of the query interface , Only in this way can we find the specific information of this order . This process is called correlation .

that JMeter How to implement Association in ?

The tool adds a post processor to the request : Regular expression extractors and json Extractor , Add path as shown in the following figure .

About regular expression extractors :

Quote name : As the request name in the next interface , Define your own ;

Regular expressions : Focus on finding the left and right boundaries of the response data , You can define multiple regular expressions . The common forms are (.*?)(.+?);

remarks :「.*?」 If the condition is met, it will only match once 、「.+?」 It means that after matching, it will directly return

Template : In the multiple regular expressions defined in the previous step, extract the first one and use  $ A few $;

Match the Numbers :-1 All match 、0 Random match 、1 The first matching value 、2 The second matching value , Usually filled in 1;

The default value : Default value when matching fails , Just define yourself .

About json Extractor :

Names of created variables: Quote name , Self defined ;

JSON Path expressions: Path expression , Generally speaking, it means how you can find the value you want to reference ;

Match No.(0 for Random): Match the Numbers ,-1 All 、0 Random 、1 Is the first 、2 It's the second one. ;

Default Values: The default value , Represents the default value of matching failure , Here you can define it as the error message in case of failure .

The above is what Daejeon shared today , If you find it useful, you can give Daejeon a compliment .

Recommended articles :

How to learn software testing ?

So busy every day , Whether to write test cases or not ?

Linux Installation and configuration of

2022.06.09, It's the first day of Datian day shift  124 / 365 God . Each article solves a specific problem , Official account , Backstage private message 「 e-book  」 Send you 1.5G Test data , Direct messages 「 Linux 」 Get a detailed explanation of the order for field consolidation .

原网站

版权声明
本文为[Field test record]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101421170003.html