Loadrunner |
1. When we record a file import in a web app using load runner, we might some times find that the files content will also be passed in the web_custom_request as a JSON request.
2. When we iterate the script we need to pass unique files as inputs and the files content also change.
3. So we need to read the files content using C Program in loadrunner and convert it into JSON format and save it in a variable and pass the variable to the web_custom_request.
4. lr_read_file loadrunner function reads the files content and saves it in a loadrunner variable.
5. As part of the JSON request CR(Carriage Return) & LF(Line Feed) at the end of each line in the text file needs to be removed. This can be achieved using strtok (StringToken) C function.
C Program:
long file;
int flength;
int fcontent;
char *mbuffer;
char *delimiter = "\r\n";
char *token;
char *temp;
char *tempall;
char *finalfile;
int res;
temp = (char *)calloc(8000000,sizeof(char));
tempall = (char *)calloc(8000000,sizeof(char));
finalfile = (char *)calloc(8000000,sizeof(char));
res = lr_read_file("C:\\ACH EFT Files\\ACH_10K_50003918_0.txt", "P_fileContent", 0);
lr_message("res = %d\n data = %s\n", res, lr_eval_string("{P_fileContent}"));
token = (char *)strtok(lr_eval_string("{P_fileContent}"), delimiter); // capture 1st sub string based on defined delimiter
while (token != NULL ) // While valid tokens are returned
{
lr_output_message ("%s", token );
strcpy(temp, token);
strcat(temp, "\\r\\n");
lr_output_message ("%s", temp );
token = (char *)strtok(NULL, delimiter); // Get the next token
strcat(tempall, temp);
}
memcpy(finalfile, tempall, strlen(tempall) -8);
lr_save_string(finalfile,"P_fileContent1");
lr_output_message("%s", lr_eval_string("{P_fileContent1}"));
We can also pass parameter values to the files path and name in lr_read_file function using lr_eval_string function
Example:
res = lr_read_file("C:\\ACH EFT Files\\ACH_10K_50003918_0.txt", "P_fileContent", 0);
In the above code replace C:\\ACH EFT Files\\ACH_10K_50003918_0.txt with the parameter P_FileName.
Now the code becomes,
res = lr_read_file(lr_eval_string("{P_FileName}"), "P_fileContent", 0);
how to contact you
ReplyDeletefor doubts please
ReplyDeleteyozgat
ReplyDeletetunceli
hakkari
zonguldak
adıyaman
27D7
ankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
5E0S5
ankara evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
antep evden eve nakliyat
giresun evden eve nakliyat
kayseri evden eve nakliyat
T54ZV
sivas evden eve nakliyat
ReplyDeleteerzurum evden eve nakliyat
bitlis evden eve nakliyat
mardin evden eve nakliyat
rize evden eve nakliyat
1İ01UC
59E1C
ReplyDeleteAltındağ Fayans Ustası
Malatya Parça Eşya Taşıma
Kütahya Şehir İçi Nakliyat
Maraş Şehir İçi Nakliyat
Bolu Şehirler Arası Nakliyat
Tekirdağ Lojistik
Yenimahalle Fayans Ustası
Binance Referans Kodu
Uşak Şehirler Arası Nakliyat
F1CF0
ReplyDeleteKırıkkale Evden Eve Nakliyat
Çankırı Şehirler Arası Nakliyat
Tesla Coin Hangi Borsada
Kütahya Evden Eve Nakliyat
Bitfinex Güvenilir mi
Ünye Oto Lastik
Uşak Lojistik
Bayburt Lojistik
Eryaman Parke Ustası
898A1
ReplyDeleteAmasya Evden Eve Nakliyat
Çerkezköy Cam Balkon
buy clenbuterol
Kırşehir Evden Eve Nakliyat
testosterone enanthate
order testosterone enanthate
Şırnak Evden Eve Nakliyat
boldenone
deca durabolin for sale
A3CFF
ReplyDeleteArtvin Kadınlarla Sohbet
Adıyaman Ucretsiz Sohbet
antalya mobil sohbet chat
canlı sohbet
Çorum Bedava Görüntülü Sohbet
Sakarya Yabancı Görüntülü Sohbet
Amasya Görüntülü Sohbet Uygulama
ankara rastgele görüntülü sohbet ücretsiz
parasız görüntülü sohbet uygulamaları
413D0
ReplyDeleteKripto Para Kazma Siteleri
Facebook Sayfa Beğeni Satın Al
Referans Kimliği Nedir
Coin Nasıl Kazılır
Shibanomi Coin Hangi Borsada
Bitcoin Kazma Siteleri
Bulut Madenciliği Nedir
Bitcoin Nasıl Para Kazanılır
Kripto Para Madenciliği Nasıl Yapılır
14151
ReplyDeleteroninchain
shiba
dappradar
poocoin
poocoin
aave
poocoin
quickswap
ellipal
TGHNCFNJHYJ
ReplyDeleteشركة تسليك مجاري بالاحساء
مهندس افران مكة DCH4dQhhmX
ReplyDeleteمكافحة حشرات yALO91R811
ReplyDeleteشركة مكافحة الحمام بالاحساء kqrPKsjCTj
ReplyDeleteشركة عزل اسطح بالرس LoZXV7BRWU
ReplyDelete