Generell instruktion för att köra lasttester med Gatling
Gatling används för att göra lasttester. Denna instruktion beskriver hur lasttester körs för VP, men den kan även appliceras på andra komponenter.
Lasttester finns i foldern: vp/performanceTests
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 = ""
Not: filen performanceTests/src/test/resources/gatling.conf kan innehålla mängder med konfiguration (se gatling konfigurationsdokumentation), men nedan är minimalt för att kunna använda HTTPS.
gatling { http { 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.