gatling-sample-framework/local-run.sh

64 lines
1.1 KiB
Bash
Raw Normal View History

2024-10-25 22:12:59 +00:00
#!/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}"