From 19b58a3fd184177e8edcedd81811ec060b2b01f7 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Fri, 25 Oct 2024 23:12:59 +0100 Subject: [PATCH] base test framework --- .gitignore | 8 ++ Dockerfile | 19 +++ README.md | 76 +++++++++++ aws-run.ps1 | 13 ++ buildspec.yml | 25 ++++ docker-entrypoint-script.sh | 26 ++++ docker-run.ps1 | 11 ++ docker-run.sh | 65 +++++++++ local-run.ps1 | 15 +++ local-run.sh | 63 +++++++++ out/placeholder.txt | 1 + pom.xml | 114 ++++++++++++++++ src/test/resources/gatling.conf | 127 ++++++++++++++++++ src/test/scala/Engine.scala | 12 ++ src/test/scala/IDEPathHelper.scala | 14 ++ src/test/scala/Recorder.scala | 12 ++ .../scala/com/organization/Environment.scala | 14 ++ .../com/organization/headers/.placeholder | 1 + .../com/organization/recordings/.placeholder | 1 + .../com/organization/scripts/.placeholder | 1 + .../scala/com/organization/tests/.placeholder | 1 + 21 files changed, 619 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 aws-run.ps1 create mode 100644 buildspec.yml create mode 100644 docker-entrypoint-script.sh create mode 100644 docker-run.ps1 create mode 100644 docker-run.sh create mode 100644 local-run.ps1 create mode 100644 local-run.sh create mode 100644 out/placeholder.txt create mode 100644 pom.xml create mode 100644 src/test/resources/gatling.conf create mode 100644 src/test/scala/Engine.scala create mode 100644 src/test/scala/IDEPathHelper.scala create mode 100644 src/test/scala/Recorder.scala create mode 100644 src/test/scala/com/organization/Environment.scala create mode 100644 src/test/scala/com/organization/headers/.placeholder create mode 100644 src/test/scala/com/organization/recordings/.placeholder create mode 100644 src/test/scala/com/organization/scripts/.placeholder create mode 100644 src/test/scala/com/organization/tests/.placeholder diff --git a/.gitignore b/.gitignore index a201e35..1d7881a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ .idea/ .vscode/ +.metals/ +target/ +dist/ +log/ +out/*.zip +out/*/** +*.iml +src/test/scala/com/williamslea/engage/recordings/*.scala diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..85ce0d4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM maven:3.9.8-eclipse-temurin-17-alpine + +RUN apk add -Uuv python3 less py-pip openssl tzdata zip +RUN apk list -I + +RUN cp /usr/share/zoneinfo/Europe/London /etc/localtime + +RUN apk --purge -v del py-pip && rm /var/cache/apk/* + +WORKDIR /build + +COPY pom.xml . + +COPY src/ /build/src +COPY docker-entrypoint-script.sh . + +RUN mvn clean install + +ENTRYPOINT ["./docker-entrypoint-script.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..06f6707 --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# Simple Gatling Load Test Framework + +This repository is a proof-of-concept demonstration of the Gatling load testing tool, in a standard Java/Scala test framework. + +Here is what you need to run one of the load simulations provided in this demo: + +## Requirements + +* Java 17 or better +* Apache Maven 3.9 or better +* Docker 27 or better (for the docker image runs) + +The maven tool will install all other necessary dependencies from Maven Central, including: + +* Scala 3 Libraries +* Gatling SDK +* Scala and Gatling runner plugins + +## Running The Tests + +There are two ways to run a test: + +* As a docker container +* On the native environment of your local machine + +### Docker Runs + +To run a test as a docker container, use the `docker-run` scripts. A version has been +created for both Windows and Linux/Mac host environments. + +The `docker-run` script takes arguments that allow you to control the load profile +of the test. It also takes arguments that enable the use of different test users. +Here is example usage: + +Powershell + +```powershell +.\docker-run.ps1 -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15 +``` + +Bash + +```bash +./docker-run.sh -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15 +``` + +### Local Runs + +To run a test from your workstation, use the `local-run` scripts. A version has been created for both Windows and Linux/Mac host environments. + +The `local-run` script takes arguments that allow you to control the load profile of the test. It also takes arguments that enable the use of different test users. Here is example usage: + +Powershell + +```powershell +.\local-run.ps1 -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15 +``` + +Bash + +```bash +./local-run.sh -test "TestClassName" -user "testuser" -pswd "password1234" -count 10 -ramp_in_minutes 5 -duration_in_minutes 15 +``` + +Arguments for both the docker and local scripts: + +* The `-test` argument requires you to supply the classname of the test you want to execute. + These can be found in the `com.organization.tests` classpath in your source directory. The + basic naming convention is Java-style. However, an arbitrary test id has been attached to the + beginning of the test name, to make it easier to locate in the test plan document. +* `-user` and `-pswd` should just be whatever test user credentials will be used for the test session user population. +* `-count` is the total number of test users to be instantiated during the test. It should be + noted that the total number of users *may not be* the *peak* number of users. That will + depend upon the next two arguments. +* `-ramp_in_minutes` is the number of minutes over which your user population will inject itself into the scenario +* `-duration_in_minutes` is the number of minutes the scenario should sustain the total population in the test diff --git a/aws-run.ps1 b/aws-run.ps1 new file mode 100644 index 0000000..ff284b0 --- /dev/null +++ b/aws-run.ps1 @@ -0,0 +1,13 @@ +param ($test, $user, $pswd, $count, $ramp_in_minutes, $duration_in_minutes) + +$env:TEST = $test +$env:TEST_USER = $user +$env:TEST_PWD = $pswd +$env:USER_COUNT = $count +$env:RAMP_DURATION = $ramp_in_minutes +$env:TEST_DURATION = $duration_in_minutes + +$classname="com.organization.tests.${test}" + +mvn install +mvn gatling:test "-DclassName=${classname}" diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000..3b42cc2 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,25 @@ +version: 0.2 + +env: + shell: powershell.exe + secrets-manager: + test_user: "aws-secrets:test_user" + test_pswd: "aws:test_pswd" + git-credential-helper: no + +proxy: + upload-artifacts: no + logs: yes + +phases: + build: + on-failure: ABORT + commands: + - $env:BASE_URL=${BASE_URL} + - .\aws-run.ps1 -test "${TEST_NAME}" -user ${test_user} -pswd ${test_pswd} -count ${USER_COUNT} -ramp_in_minutes ${RAMP} -duration_in_minutes ${DURATION} +artifacts: + files: + - 'target/gatling/**/*' + name: gatling-test-report-$(date +%Y-%m-%d) + discard-paths: no + enable-symlinks: yes diff --git a/docker-entrypoint-script.sh b/docker-entrypoint-script.sh new file mode 100644 index 0000000..acdf2f8 --- /dev/null +++ b/docker-entrypoint-script.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +# NOTE: This script is meant to run as the entry point script for the docker container. +# Running this directly from the host system may produce unexpected results + +#pipx install awscli --force + +export PATH="${PATH}":/root/.local/bin + +#which aws + +# mvn clean install +mvn gatling:test '-DclassName=com.organization.tests.'"${TEST}"'' + +cid="$(awk -F/ '{print $NF}' /proc/1/cpuset)" +#cid=$(cat /dev/urandom |tr -dc 'a-zA-Z0-9'|fold -w 20|head -n 1) + +echo "CID: ${cid}" +# REPORT_BUCKET="REPORT_BUCKET" + +for _dir in /build/target/gatling/*/ +do + zip -r test_report_"${TEST}"_"${cid}".zip "${_dir}" + # zip -r test_report.zip "${_dir}" # will be copied to /out later + # aws s3 cp --recursive --dryrun "${_dir}" s3://"${REPORT_BUCKET}"/test_report_"${TEST}"_"${cid}"/ +done diff --git a/docker-run.ps1 b/docker-run.ps1 new file mode 100644 index 0000000..8d5a04f --- /dev/null +++ b/docker-run.ps1 @@ -0,0 +1,11 @@ +param ($test, $user, $pswd, $count, $ramp_in_minutes, $duration_in_minutes) + +$env:BASE_URL="subdomain.organization.com" +$env:DOCKER_IMAGE="gatling-load-test" +$env:DOCKER_CONTAINER="gatling_load_test" + +docker rm ${DOCKER_CONTAINER} +docker build -t ${DOCKER_IMAGE}:1.0 . +docker run -e TEST="$test" -e TEST_USER="$user" -e TEST_PWD="$pswd" -e BASE_URL=$env:BASE_URL -e USER_COUNT="$count" -e RAMP_DURATION="$ramp_in_minutes" -e TEST_DURATION="$duration_in_minutes" --name ${DOCKER_CONTAINER} -p 8000:8000 ${DOCKER_IMAGE}:1.0 +$cid = docker ps --no-trunc -aqf name=${DOCKER_CONTAINER} +docker cp ${cid}:/build/test_report_"${test}"_"${cid}".zip .\out\ diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 0000000..3a33501 --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env sh + +# ############################################ +# This is the unix/linux version of the windows script for running the load tests +# via the docker container +# ############################################ + +# Initialize variables +export URL="subdomain.organization.com" +DOCKER_IMAGE="gatling-load-test" +DOCKER_CONTAINER="gatling_load_test" + +test="" +user="" +pswd="" +count="" +ramp="" +duration="" + +# Parse arguments +while [ $# -gt 0 ]; do + case "$1" in + -test) + test="$2" + shift 2 + ;; + -user) + user="$2" + shift 2 + ;; + -pswd) + pswd="$2" + shift 2 + ;; + -count) + count="$2" + shift 2 + ;; + -ramp_in_minutes) + ramp="$2" + shift 2 + ;; + -duration_in_minutes) + duration="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; + esac +done + +# Check mandatory arguments +if [ -z "$test" ] || [ -z "$user" ] || [ -z "$pswd" ] || [ -z "$count" ] || [ -z "$ramp" ] || [ -z "$duration" ]; then + echo "Usage: $0 -test \"testname\" -user \"userid\" -pswd \"password\" -count n -ramp_in_minutes n -duration_in_minutes n" + exit 1 +fi + +docker rm ${DOCKER_CONTAINER} +docker build -t ${DOCKER_IMAGE}:1.0 . +docker run -e TEST="${test}" -e TEST_USER="${user}" -e TEST_PWD="${pswd}" -e BASE_URL="${URL}" -e USER_COUNT="$count" -e RAMP_DURATION="$ramp" -e TEST_DURATION="$duration" --name ${DOCKER_CONTAINER} -p 8000:8000 ${DOCKER_IMAGE}:1.0 + +cid=$(docker ps --no-trunc -aqf name=${DOCKER_CONTAINER}) +docker cp "${cid}":/build/test_report.zip ./out/test_report_"${test}"_"${cid}".zip diff --git a/local-run.ps1 b/local-run.ps1 new file mode 100644 index 0000000..4681d10 --- /dev/null +++ b/local-run.ps1 @@ -0,0 +1,15 @@ +param ($test, $user, $pswd, $count, $ramp_in_minutes, $duration_in_minutes) + +$env:BASE_URL="subdomain.organization.com" + +$env:TEST = $test +$env:TEST_USER = $user +$env:TEST_PWD = $pswd +$env:USER_COUNT = $count +$env:RAMP_DURATION = $ramp_in_minutes +$env:TEST_DURATION = $duration_in_minutes + +$classname="com.organization.tests.${test}" + +mvn install +mvn gatling:test "-DclassName=${classname}" diff --git a/local-run.sh b/local-run.sh new file mode 100644 index 0000000..fc5c754 --- /dev/null +++ b/local-run.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Initialize variables +url="https://subdomain.organization.com" + +test="" +user="" +pswd="" +count="" +ramp="" +duration="" + +# Parse arguments +while [ $# -gt 0 ]; do + case "$1" in + -test) + test="$2" + shift 2 + ;; + -user) + user="$2" + shift 2 + ;; + -pswd) + pswd="$2" + shift 2 + ;; + -count) + count="$2" + shift 2 + ;; + -ramp_in_minutes) + ramp="$2" + shift 2 + ;; + -duration_in_minutes) + duration="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; + esac +done + +echo $test + +# Check mandatory arguments +if [ -z "$test" ] || [ -z "$user" ] || [ -z "$pswd" ] || [ -z "$count" ] || [ -z "$ramp" ] || [ -z "$duration" ]; then + echo "Usage: $0 -test \"testname\" -user \"userid\" -pswd \"password\" -count n -ramp_in_minutes n -duration_in_minutes n" + exit 1 +fi + +export BASE_URL="${url}" +export TEST_USER="${user}" +export TEST_PWD="${pswd}" +export USER_COUNT="${count}" +export RAMP_DURATION="${ramp}" +export TEST_DURATION="${duration}" + +mvn clean install +mvn gatling:test "-DclassName=com.organization.tests.${test}" diff --git a/out/placeholder.txt b/out/placeholder.txt new file mode 100644 index 0000000..e455e11 --- /dev/null +++ b/out/placeholder.txt @@ -0,0 +1 @@ +PRESERVE THE OUT DIRECTORY, BUT NOT THE CONTENTS \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9376298 --- /dev/null +++ b/pom.xml @@ -0,0 +1,114 @@ + + + 4.0.0 + com.organization + gatling-sample-framework + 1.0-SNAPSHOT + + + 1.8 + 1.8 + UTF-8 + + + 3.5.1 + 4.9.2 + + + 3.6.1 + 4.10.0 + + + + + + + + + + org.scala-lang + scala3-library_3 + ${scala.version} + + + + org.scala-lang + scala3-compiler_3 + ${scala.version} + + + + org.scala-lang + scala3-sbt-bridge + 3.5.1 + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + + io.gatling.highcharts + gatling-charts-highcharts + ${gatling.version} + + + io.gatling + gatling-app + ${gatling.version} + + + io.gatling + gatling-recorder + ${gatling.version} + + + + + src/test/scala + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + + + + + net.alchim31.maven + scala-maven-plugin + ${scala-maven-plugin.version} + + + + testCompile + + + + -deprecation + -feature + -unchecked + -language:implicitConversions + -language:postfixOps + + + + + + + io.gatling + gatling-maven-plugin + ${gatling-maven-plugin.version} + + ${className} + + + + + diff --git a/src/test/resources/gatling.conf b/src/test/resources/gatling.conf new file mode 100644 index 0000000..d644831 --- /dev/null +++ b/src/test/resources/gatling.conf @@ -0,0 +1,127 @@ +######################### +# Gatling Configuration # +######################### + +# This file contains all the settings configurable for Gatling with their default values + +gatling { + core { + #outputDirectoryBaseName = "" # The prefix for each simulation result folder (then suffixed by the report generation timestamp) + #runDescription = "" # The description for this simulation run, displayed in each report + #encoding = "utf-8" # Encoding to use throughout Gatling for file and string manipulation + #simulationClass = "" # The FQCN of the simulation to run (when used in conjunction with noReports, the simulation for which assertions will be validated) + #elFileBodiesCacheMaxCapacity = 200 # Cache size for request body EL templates, set to 0 to disable + #rawFileBodiesCacheMaxCapacity = 200 # Cache size for request body Raw templates, set to 0 to disable + #rawFileBodiesInMemoryMaxSize = 1000 # Below this limit, raw file bodies will be cached in memory + #pebbleFileBodiesCacheMaxCapacity = 200 # Cache size for request body Peeble templates, set to 0 to disable + #feederAdaptiveLoadModeThreshold = 100 # File size threshold (in MB). Below load eagerly in memory, above use batch mode with default buffer size + #shutdownTimeout = 10000 # Milliseconds to wait for the actor system to shutdown + extract { + regex { + #cacheMaxCapacity = 200 # Cache size for the compiled regexes, set to 0 to disable caching + } + xpath { + #cacheMaxCapacity = 200 # Cache size for the compiled XPath queries, set to 0 to disable caching + } + jsonPath { + #cacheMaxCapacity = 200 # Cache size for the compiled jsonPath queries, set to 0 to disable caching + } + css { + #cacheMaxCapacity = 200 # Cache size for the compiled CSS selectors queries, set to 0 to disable caching + } + } + directory { + #simulations = "" # If set, directory where simulation classes are located + #resources = "" # If set, directory where resources, such as feeder files and request bodies, are located + #reportsOnly = "" # If set, name of report folder to look for in order to generate its report + #binaries = "" # If set, name of the folder where compiles classes are located: Defaults to GATLING_HOME/target. + #results = results # Name of the folder where all reports folder are located + } + } + socket { + #connectTimeout = 10000 # Timeout in millis for establishing a TCP socket + #tcpNoDelay = true + #soKeepAlive = false # if TCP keepalive configured at OS level should be used + #soReuseAddress = false + } + netty { + #useNativeTransport = true # if Netty native transport should be used instead of Java NIO + #allocator = "pooled" # switch to unpooled for unpooled ByteBufAllocator + #maxThreadLocalCharBufferSize = 200000 # Netty's default is 16k + } + ssl { + #useOpenSsl = true # if OpenSSL should be used instead of JSSE (only the latter can be debugged with -Djava.net.debug=ssl) + #useOpenSslFinalizers = false # if OpenSSL contexts should be freed with Finalizer or if using RefCounted is fine + #handshakeTimeout = 10000 # TLS handshake timeout in millis + #useInsecureTrustManager = true # Use an insecure TrustManager that trusts all server certificates + #enabledProtocols = [] # Array of enabled protocols for HTTPS, if empty use Netty's defaults + #enabledCipherSuites = [] # Array of enabled cipher suites for HTTPS, if empty enable all available ciphers + #sessionCacheSize = 0 # SSLSession cache size, set to 0 to use JDK's default + #sessionTimeout = 0 # SSLSession timeout in seconds, set to 0 to use JDK's default (24h) + #enableSni = true # When set to true, enable Server Name indication (SNI) + keyStore { + #type = "" # Type of SSLContext's KeyManagers store + #file = "" # Location of SSLContext's KeyManagers store + #password = "" # Password for SSLContext's KeyManagers store + #algorithm = "" # Algorithm used SSLContext's KeyManagers store + } + trustStore { + #type = "" # Type of SSLContext's TrustManagers store + #file = "" # Location of SSLContext's TrustManagers store + #password = "" # Password for SSLContext's TrustManagers store + #algorithm = "" # Algorithm used by SSLContext's TrustManagers store + } + } + charting { + #noReports = false # When set to true, don't generate HTML reports + #maxPlotPerSeries = 1000 # Number of points per graph in Gatling reports + #useGroupDurationMetric = false # Switch group timings from cumulated response time to group duration. + indicators { + #lowerBound = 800 # Lower bound for the requests' response time to track in the reports and the console summary + #higherBound = 1200 # Higher bound for the requests' response time to track in the reports and the console summary + #percentile1 = 50 # Value for the 1st percentile to track in the reports, the console summary and Graphite + #percentile2 = 75 # Value for the 2nd percentile to track in the reports, the console summary and Graphite + #percentile3 = 95 # Value for the 3rd percentile to track in the reports, the console summary and Graphite + #percentile4 = 99 # Value for the 4th percentile to track in the reports, the console summary and Graphite + } + } + http { + #fetchedCssCacheMaxCapacity = 200 # Cache size for CSS parsed content, set to 0 to disable + #fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable + #perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable + #warmUpUrl = "https://gatling.io" # The URL to use to warm-up the HTTP stack (blank means disabled) + #enableGA = true # Very light Google Analytics (Gatling and Java version), please support + #pooledConnectionIdleTimeout = 60000 # Timeout in millis for a connection to stay idle in the pool + requestTimeout = 240000 + #enableHostnameVerification = false # When set to true, enable hostname verification: SSLEngine.setHttpsEndpointIdentificationAlgorithm("HTTPS") + dns { + #queryTimeout = 5000 # Timeout in millis of each DNS query in millis + #maxQueriesPerResolve = 6 # Maximum allowed number of DNS queries for a given name resolution + } + } + jms { + #replyTimeoutScanPeriod = 1000 # scan period for timedout reply messages + } + data { + #writers = [console, file] # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite) + console { + #light = false # When set to true, displays a light version without detailed request stats + #writePeriod = 5 # Write interval, in seconds + } + file { + #bufferSize = 8192 # FileDataWriter's internal data buffer size, in bytes + } + leak { + #noActivityTimeout = 30 # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening + } + graphite { + #light = false # only send the all* stats + #host = "localhost" # The host where the Carbon server is located + #port = 2003 # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle) + #protocol = "tcp" # The protocol used to send data to Carbon (currently supported : "tcp", "udp") + #rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite + #bufferSize = 8192 # Internal data buffer size, in bytes + #writePeriod = 1 # Write period, in seconds + } + } +} diff --git a/src/test/scala/Engine.scala b/src/test/scala/Engine.scala new file mode 100644 index 0000000..dc29034 --- /dev/null +++ b/src/test/scala/Engine.scala @@ -0,0 +1,12 @@ +import io.gatling.app.Gatling +import io.gatling.core.config.GatlingPropertiesBuilder + +object Engine extends App { + + val props = new GatlingPropertiesBuilder() + .resourcesDirectory(IDEPathHelper.mavenResourcesDirectory.toString) + .resultsDirectory(IDEPathHelper.resultsDirectory.toString) + .binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString) + + Gatling.fromMap(props.build) +} diff --git a/src/test/scala/IDEPathHelper.scala b/src/test/scala/IDEPathHelper.scala new file mode 100644 index 0000000..c01e1d7 --- /dev/null +++ b/src/test/scala/IDEPathHelper.scala @@ -0,0 +1,14 @@ +import java.nio.file.{Path, Paths} + +object IDEPathHelper { + + private val projectRootDir = Paths.get(getClass.getClassLoader.getResource("gatling.conf").toURI).getParent.getParent.getParent + private val mavenTargetDirectory = projectRootDir.resolve("target") + private val mavenSrcTestDirectory = projectRootDir.resolve("src").resolve("test") + + val mavenSourcesDirectory: Path = mavenSrcTestDirectory.resolve("scala") + val mavenResourcesDirectory: Path = mavenSrcTestDirectory.resolve("resources") + val mavenBinariesDirectory: Path = mavenTargetDirectory.resolve("test-classes") + val resultsDirectory: Path = mavenTargetDirectory.resolve("gatling") + val recorderConfigFile: Path = mavenResourcesDirectory.resolve("recorder.conf") +} diff --git a/src/test/scala/Recorder.scala b/src/test/scala/Recorder.scala new file mode 100644 index 0000000..1bfd1a3 --- /dev/null +++ b/src/test/scala/Recorder.scala @@ -0,0 +1,12 @@ +import io.gatling.recorder.GatlingRecorder +import io.gatling.recorder.config.RecorderPropertiesBuilder + +object Recorder extends App { + + val props = new RecorderPropertiesBuilder() + .simulationsFolder(IDEPathHelper.mavenSourcesDirectory.toString) + .resourcesFolder(IDEPathHelper.mavenResourcesDirectory.toString) + .simulationPackage("com.organization") + + GatlingRecorder.fromMap(props.build, Some(IDEPathHelper.recorderConfigFile)) +} diff --git a/src/test/scala/com/organization/Environment.scala b/src/test/scala/com/organization/Environment.scala new file mode 100644 index 0000000..199452f --- /dev/null +++ b/src/test/scala/com/organization/Environment.scala @@ -0,0 +1,14 @@ +package com.organization + +import scala.util.Properties.envOrElse + +object Environment { + val letsEncryptUrl: String = "http://r10.o.lencr.org" + val baseUrl: String = envOrElse("BASE_URL", "subdomain.organization.com") + val testUser: String = envOrElse("TEST_USER", "undefined") + val testPwd: String = envOrElse("TEST_PWD", "undefined") + val fullUrl: String = "https://"+baseUrl + val userCount: String = envOrElse("USER_COUNT", "1") + val rampDuration: String = envOrElse("RAMP_DURATION", "1") + val testDuration: String = envOrElse("TEST_DURATION", "1") +} \ No newline at end of file diff --git a/src/test/scala/com/organization/headers/.placeholder b/src/test/scala/com/organization/headers/.placeholder new file mode 100644 index 0000000..af04111 --- /dev/null +++ b/src/test/scala/com/organization/headers/.placeholder @@ -0,0 +1 @@ +# preserve directory in git \ No newline at end of file diff --git a/src/test/scala/com/organization/recordings/.placeholder b/src/test/scala/com/organization/recordings/.placeholder new file mode 100644 index 0000000..af04111 --- /dev/null +++ b/src/test/scala/com/organization/recordings/.placeholder @@ -0,0 +1 @@ +# preserve directory in git \ No newline at end of file diff --git a/src/test/scala/com/organization/scripts/.placeholder b/src/test/scala/com/organization/scripts/.placeholder new file mode 100644 index 0000000..af04111 --- /dev/null +++ b/src/test/scala/com/organization/scripts/.placeholder @@ -0,0 +1 @@ +# preserve directory in git \ No newline at end of file diff --git a/src/test/scala/com/organization/tests/.placeholder b/src/test/scala/com/organization/tests/.placeholder new file mode 100644 index 0000000..af04111 --- /dev/null +++ b/src/test/scala/com/organization/tests/.placeholder @@ -0,0 +1 @@ +# preserve directory in git \ No newline at end of file