VUGen or Virtual User Generator is an IDE.
VUGen is a Performance Testing tool used to replicate
System Under Load (SUL) behavior.
Pioneered by Mercury in 1999, later acquired by HPE in 2006.
In 2016, Loadrunner was acquired by MicroFocus.
Once a VUser script is finalized, Controller is the main component
which controls the Load simulation.
VUsers for an HTTP script will require 2-4MB per VUser for simulation,
hence 4 machines with 4 GB RAM each will be required to simulate a load of 10,000 VUsers.
Performance Testing is a discipline concerned with testing and reporting
the current performance of a software application under various parameters.
Performance engineering is the process by which software is tested
and tuned with the intent of realizing the required performance.
La suite Loadrunner a 4 composants:
- The Virtual User Generator or VuGen records end-user business processes
and creates an automated performance testing script, known as a Vuser script.
- The Controller organizes, drives, manages, and monitors the load test.
- Analysis helps you view, dissect, and compare the results of the load tests.
- Load Generators are computers that run Vusers to generate a load on the system.
Structure d'un script --------------------------------------------------
Vuser_init(1re section exécutée durant initialisation)
Action (used to record the business process)
Vuser_end (used to logout of the application)
Quel protocole d'enregistrement?
To use Protocol Advisor, go to Record => Protocol Advisor => Analyze Application
Transactions -----------------------------------------------------------
//open a transaction
lr_start_transaction("Transaction Name");
// close a transaction
lr_end_transaction("Transaction Name");
status tells LoadRunner whether this particular transaction was successful or unsuccessful
LR_AUTO LoadRunner will automatically handle server error (HTTP 500, 400 etc.)
LR_PASS
LR_FAIL
Example:
lr_end_transaction("My_Login", LR_AUTO);
lr_end_transaction("001_Opening_Dashboard Name", LR_PASS);
lr_end_transaction("Business_Workflow_Transaction Name", LR_FAIL);
Period (.) character is not allowed in transaction name, although you can use spaces and underscore.
Charger une dll --------------------------------------------------------
lr_load_dll("mydll.dll");
myfun(); /* defined in mydll.dll -- can be called directly,
immediately after mydll.dll is loaded. */
Exécution --------------------------------------------------------------
F5
Rendezvous Points
lr_rendesvous(“rdv_Logical Name”);
Rendezvous points instruct VUser to wait during test execution for
multiple VUser to arrive at a certain point, so that they may concurrently
perform a task.
Syntaxe ----------------------------------------------------------------
c is a case-sensitive language
Types
These are equivalent:
char *example = "abcd" "efgh";
char *example = "abcdefgh";
\x24 is 16*2+4=36, which is a $ sign
\x2B is + sign
\x2 is not a valid 2–character hexadecimal sequence. Use \x02, instead.
In Vugen scripts, you need to explicitly declare C functions that do not return integers
extern char* strtok(char *token, const char *delimiter);
In Linux C scripting, wchar_t and functions returning a struct or
union are not supported for functions from external libraries.
For example, div_t div(int a, int b) is not supported.
Signals
Load Generators control Vusers by sending SIGHUP, SIGUSR1,
and SIGUSR2 Linux signals. Do not use these signals in your Vuser scripts.
Fonctions référence ----------------------------------------------------
function_reference/FuncRef.htm
Sockets
Install ----------------------------------------------------------------
guide-to-download-and-install-hp-loadrunner-12-0.html
télécharger archive
extraire archive
lancer install
télécharger Webtours, lancer le msi pour installer apache,
Recording --------------------------------------------------------------
Recording
HTML based script ou URL based script?
HTML based script
* script size is small
* preferable when we want to measure an entire page
URL based script
* Script size is larger
* Préférable pour mesurer le chargement d'un composant de la page
Lancer apache (par le batch)
Cliquer sur record,
naviguer (http://127.0.0.1:1080/WebTours identiant jojo mdp bean)
stopper enregistrement
Correlation
Correlation
replay: il ne trouve pas le session ID
Identifier les valeurs à corréler
Pour identifier quoi correler, lancer deux tests et comparer la
sortie avec un diff: le session ID est ce qui est diférent. à variabiliser avec
Après la requête (web_url()) clic droit/insert Step
Le Step Toolbox apparait, rechercher web_reg_save_param
web_reg_save_param("SessionID",
"LB="Name=Jsession", "value=",
"RB=",
ENDITEM",
LAST);
Left Boundary et Right boundary
web_reg_save_param_ex(
"ParamName=User_Session_param", // nom de la variable
"LB=\"left boundary\"",
"RB=\"right boundary\"",
SEARCH_FILTERS,
LAST);
Puis changer les valeurs par {variable}
barre d'outils/cliquer sur Design studio
sélectionner la variable et cliquer sur correler: il met une varibale
Fermer le studio
il a ajouté web_reg_save_param_attrib dans le code
si Google chrome erreur auth et 401: spécificité de chrome qui se
connecte en arrière-plan chez google.
Menu Record/Recording options/Mapping and Filtering->Traffic filtering
Se connecter à webtours produira ce script:
Action()
{
/*Possible OAUTH authorization was detected.
It is recommended to correlate the authorization parameters.*/
web_set_sockets_option("SSL_VERSION", "2&3");
//web_add_header("Upgrade-Insecure-Requests", "1");
//web_url() Loads the specified Web page (GET request)
web_url("Webtours",
"URL=http://127.0.0.1:1080/Webtours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
return 0;
}
Replay
Menu Replay/Runtime settings (F4)
Run logic/Number of iterations indique le nombre d'exécutions
Mettre 2.
Pacing: temps entre deux itérations
Preparing
Menu View/Step navigator
rechercher reservations.pl
clic droit, show arguments
Cliquer sur seatpref/ABC parameter properties
Bouton Add: ajouter Aisle, Window, None
et cliquer Close puis OK
il a remplacé: "Name=seatPref", "Value={seat}", ENDITEM,
Donc à chaque itération, il remplacera la valeur par un nouveau type de fauteuil
How do I verify Web page content?
Text check. Checks that a text string appears on a web page.
Image check. Checks for an image on a web page.
On va faire un text check pour vérifier si Find Flight
se trouve bien dans la page de réservations
Step Navigator
rechercher Submit Form: reservations.pl
VuGen toolbar, click the Show Snapshot pane
Step Navigator/double-clic sur reservations.pl
menu/View/Steps Toolbox et rechercher web_reg
drag web_reg_find & drop juste avant web_submit_form()
search for specifi text: écrire FindFlight
Et cliquer ok: il ajoute le web_reg_find()
Lors de l'exécution il dira s'il le trouve ou pas
How can I produce debugging information?
dans Step Navigator rechercher image:SignOffButton
double-cliquer dessus
Steps toolbox/Common/ localiser lr_output_message
le draguer juste avant web_image()
Message Text: The flight was booked
Pour un message d'erreur c'est pareil lr_error_message()
F4/internet protocol/preferences
sélectionner image and text check et OK et replay
Références -------------------------------------------------------------
https://fr.wikipedia.org/wiki/HP_LoadRunner
https://admhelp.microfocus.com/lr/en/12.53/help/WebHelp/Content/VuGen/c_c_vuser_scripts.htm
https://www.northwaysolutions.com/under-the-hood-the-loadrunner-compiler/