Jmeter Dzidziso: Maitiro Ekutumira iyo JSON Faira seChikumbiro muMuviri

Mune ino JMeter Tutorial, isu tinotsanangura nzira yekutumira imwe kana akawanda maJSON mafaera mumuviri wechikumbiro cheHTTP.

Kana tichiyedza RESTful API, isu tinowanzo tumira POST chikumbiro kune REST API muJSON fomati. Iyo parameter yekukumbira muJSON fomati inoda kutumirwa mumuviri wechikumbiro cheHTTP.

Kutanga, iwe unozoda chinyorwa faira nechikumbiro cheJSON. Isu tinoshandisa iyi faira kutumira kune yedu REST API mumuviri wechikumbiro chePOST.

Ngatitii, iyo faira iri mukati /Users/testing-excellence/Perf/blog/json_request.txt

jmeter-json-chikumbiro-post

Yedu JMeter script ichatarisa chakadai.



jmeter-post-chikumbiro-json

Mune mamwe mazwi, isu tinofanirwa kusarudza iyo Dhata Muviri muHTTP Sampler uye nekuisa inotevera tambo yekodhi

${__FileToString(/Users/testing-excellence/Perf/blog/${__eval(${json_file})}.txt,,)}

Zviripachena, iyo nzira ichave yakasiyana pamushini wako.

Mutsara uri pamusoro unotora zvirimo mufaira rakanzi json_file.txt uye rinotumira zvirimo mumuviri wechikumbiro kune REST API.

Sezvo JMeter inonyanya kushandiswa pakuita uye kuyedza kuyedza, tinogona kurodha bvunzo yedu REST API nekutumira zvikumbiro zvakawanda zveJSON.

Kuti tiite izvozvo tinoshandisa iyo JMeter's CVS Data Set Config element.

Mune iyo CSV faira, isu tine ikholamu ine mazita eiyo JSON yekukumbira mafaera. Iyi faira CSV inoshanda sereferenzi kumafaira eJSON.

Ngatitii tine gumi mafaera eJSON, ane mazita emazita 100.txt, 101.txt, 103.txt… .110.txt

jmeter-post-json-chikumbiro

Uye iyo CSV faira ichaita senge:

jmeter-csv-json-chikumbiro

Zvino muJMeter, tinowedzera iyo CSV Data Set Config element kuchirongwa chedu chekuyedza

json-csv-chikumbiro-post-jmeter

Musiyano iJSON_FILE iyo inotora kukosha kwezana, 101, 102, nezvimwe… kubva ku CSV faira.

Ipapo isu tinofanirwa kunongedzera uyu musiyano mune yedu __FileToString() JMeter basa, i.e.

jmeter-json-faira-csv-chikumbiro

Kana isu tichiita iyi JMeter bvunzo, inozununguka kuburikidza neCVS, ichitora yega yega zita refaira uye kuburitsa zviri mukati mefaira rega rega kutumira seJSON mumuviri wechikumbiro.