Maitiro Ekuparadzanisa mhinduro yeJSON Uchishandisa JMeter's JSON Extractor

Kubva paJMeter 3.0, zviri nyore kwazvo kutora data kubva kuJSON mhinduro uchishandisa iyo JSON inoshandura inotora. JSON iri yakapusa data dhata fomati yakatora pamusoro XML makore mashoma apfuura.

Huwandu huri kuwedzera hweREST APIs nemaseva, vari kushandisa JSON senzira yavo yekutanga yekuchinjana dhata. Pano, isu tinoshandisa JMeter kuongorora mhinduro yeJSON.

Kana iwe usina JMeter yakaiswa, verenga ichi chinyorwa chinotsanangura maitiro ekuisa JMeter paMac OS .

Ngatitii tine mhinduro yeJSON seinotevera:

{
'store': {
'book': [

{


'category': 'reference',


'author': 'Nigel Rees',


'title': 'Sayings of the Century',


'price': 8.95

},

{


'category': 'fiction',


'author': 'Evelyn Waugh',


'title': 'Sword of Honour',


'price': 12.99

}
],
'bicycle': {

'color': 'red',

'price': 19.95
}
},
'expensive': 10 }

Kuti tienzanise iri pamusoro JSON neJMeter, tinoda kuwedzera iyo JSON Inotora kune yedu bvunzo chirongwa.

Right tinya Bvunzo Chirongwa -> Wedzera -> Post maProsesa -> JSON Anoburitsa



Zvino, isu tinofanirwa kuona inotevera maonero:

Mundima yeJSON Path yekutaura, tinogona kuisa nzira yedu yeJSON kuongorora mhinduro yeJSON

Heano mimwe mienzaniso Json Path zvirevo zvinogona kushandiswa kutora dhata kubva kuJson gwaro rakafumurwa pamusoro:

+---------------------------------------+--------------------------------------------------------------+ | JSONPath





| Result










| +---------------------------------------+--------------------------------------------------------------+ | $.store.book[*].author


| The authors of all books






| | $..author




| All authors









| | $.store.*




| All things, both books and bicycles




| | $.store..price



| The price of everything






| | $..book[0,1]




| The first two books







| | $..book[:2]




| All books from index 0 (inclusive) until index 2 (exclusive) | | $..book[2:]




| Book number two from tail






| | $..book[?(@.isbn)]



| All books with an ISBN number





| | $.store.book[?(@.price < 10)]
| All books in store cheaper than 10




| | $..book[?(@.price <= $[‘expensive’])] | All books in store that are not “expensive”


| | $..book[?(@.author =~ /.*REES/i)]
| All books matching regex (ignore case)



| | $..*





| Give me every thing







| | $..book.length()



| The number of books







| +---------------------------------------+--------------------------------------------------------------+