Gatling används för att göra lasttester. Denna instruktion beskriver hur lasttester körs för VP, men den kan appliceras på andra komponenter också.
Lasttester finns i foldern …loadTest
Köra Gatling tester
1.Uppdatera konfiguration av certifikat vid behov, tex för att använda ett eget SITHS certifikat.
Observera att keyStore måste ha algorithm = ""
ssl { trustStore { type = "JKS" file = "user-files/certs/truststore.jks" password = "password" #algorithm = "" } keyStore { type = "JKS" file = "user-files/certs/keystore.jks" password = "password" algorithm = "" } }
2. Identifiera vilka tester som finns att köra. Dessa finns registrerade under olika profiler i Maven.
$mvn help:all-profiles [INFO] Listing Profiles for Project: se.skltp.vp:vp-performance-tests:jar:2.2.10-SNAPSHOT Profile Id: sonatype-nexus-staging (Active: true , Source: settings.xml) Profile Id: PingHttp (Active: false , Source: pom) Profile Id: PingHttps (Active: false , Source: pom) Profile Id: GetSubjectOfCareHttps (Active: false , Source: pom) Profile Id: SendMedicalCertificateAnswer (Active: false , Source: pom) Profile Id: LoadTestVP (Active: false , Source: pom) Profile Id: ResetCache (Active: false , Source: pom) Profile Id: license (Active: false , Source: pom) Profile Id: sonatype-oss-release (Active: false , Source: pom)
3. Välj ett test (exempelvis PingHttps som nedan) och ange parametrar i de fall du vill göra override på defaultvärden. Vilka parametrar som finns anges under instruktionen för respektive komponent.
mvn test -P PingHttps ... Simulation se.skltp.vp.PingOkSimulationHttps started... ... ================================================================================ 2015-03-02 10:57:08 5s elapsed ---- Ping OK https scenario ---------------------------------------------------- [------------------------------------- ] 0% waiting: 5 / active: 5 / done:0 ---- Requests ------------------------------------------------------------------ > Global (OK=14 KO=0 ) > Ping (OK=14 KO=0 ) ================================================================================Simulation finished. ... Simulation finished Parsing log file(s)... Parsing log file(s) done Generating reports... ================================================================================ ---- Global Information -------------------------------------------------------- > request count 603 (OK=603 KO=0 ) > min response time 17 (OK=17 KO=- ) > max response time 303 (OK=303 KO=- ) > mean response time 24 (OK=24 KO=- ) > std deviation 12 (OK=12 KO=- ) > response time 50th percentile 23 (OK=23 KO=- ) > response time 75th percentile 26 (OK=26 KO=- ) > mean requests/sec 8.67 (OK=8.67 KO=- ) ---- Response Time Distribution ------------------------------------------------ > t < 800 ms 603 (100%) > 800 ms < t < 1200 ms 0 ( 0%) > t > 1200 ms 0 ( 0%) > failed 0 ( 0%) ================================================================================ Reports generated in 0s. Please open the following file: /Users/matsekhammar/Documents/GIT/SKLTP/vp/performanceTests/target/gatling/results/pingoksimulationhttps-1425290223913/index.html [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:15 min [INFO] Finished at: 2015-03-02T10:58:14+01:00 [INFO] Final Memory: 11M/310M [INFO] ------------------------------------------------------------------------
4. Hantera Gatling testrapport
Öppna länken som anges när testet körts klart för att se utfallet av testerna.
NOTE JOHANNA 2014-06-26
Kopierat från GetAggregatedRequestActivitiesSimulation. Detta känns som om det borde vara en del av en generell testinstruktion.
Genomföra testerna - Här skall det inte vara något nytt när vi kör på nya sättet!
- Ladda ner och packa upp gatling
- Kopiera aggregerande tjänstens gatling-script till <gatling_home>/user-files/<data|request-bodies|simulations>
- Uppdatera adress till målmiljö i <gatling_home>/user-files/simulations/agp/GetAggregatedRequestActivitiesSimulation_load.scala och GetAggregatedRequestActivitiesSimulation_robustness.scala
- Säkerställ att certifikat finns på plats och är konfigurerade i <gatling_home>/conf/gatling.conf. De certifikat som paketeras med i testerna fungerar endast för lokala tester. För att testa i en QA miljö kan andra, skarpa certifikat behövas.
Starta gatling från kommandoraden
$cd gatling/bin/
$./gatling.sh
Välj korrekt simulering, tryck enter:
Choose a simulation number:
[
0
] agp.GetAggregatedRequestActivitiesSimulation
0
Tryck enter 3 ggr för att köra på defaultvärden, simuleringen startar:
Select simulation id (
default
is
'getaggregatedrequestactivitiessimulation'
). Accepted characters are a-z, A-Z,
0
-
9
, - and _
Select run description (optional)
Simulation agp.GetAggregatedRequestActivitiesSimulation started...
================================================================================
2014
-
06
-
18
12
:
17
:
28
5s elapsed
---- GetAggregatedRequestActivities --------------------------------------------
Users : [--------------------------------- ]
0
%
waiting:
5
/ running:
5
/ done:
0
---- Requests ------------------------------------------------------------------
> Global OK=
3
KO=
0
> GetAggregatedRequestActivities
199008252398
- Oskar Johansson OK=
2
KO=
0
> GetAggregatedRequestActivities
188803099368
- Agda Andersson OK=
1
KO=
0
================================================================================
Körningen klar, öppna resultatet i en webläsare:
Simulation finished.
Simulation successful.
Generating reports...
Reports generated in 0s.
Please open the following file : /Users/hansthunberg/Temp/gatling-charts-highcharts-
1.5
.
3
/results/getaggregatedrequestactivitiessimulation-
20140618121722
/index.html
- Rapporera testresultatet i form av gatlingrapporten (zippad) och skärmdumpar med JConsole eller VisualVM