# jmeter-test

[Grafana Dashboards](https://watchtower.infrastr.co/d/xfpJB9FGz/1-node-exporter-for-prometheus-dashboard-en-v20201010?orgId=1&var-origin_prometheus=&var-job=node&var-hostname=All&var-node=infra-qa-jmeter-1a-01-prod-22softlabs-audit&var-device=All&var-interval=2m&var-maxmount=%2F&var-show_hostname=infra-qa-jmeter-1a-01-prod.22softlabs-audit&var-total=572&var-instance_type=t3a.small&from=now-15m&to=now&refresh=15s)

HOST: <br /> 
TOR1 - 138.197.147.110 <br />
SGP1 - 167.172.74.136 <br />
NL1 - 68.183.4.80 <br />
AWS - [10.250.20.210](http://10.250.20.210/)

All hosts are updated with by gitlab Jmeter CI https://gitlab.dev20bet.com/itlabs22/pipelines/jmeter-ci <br />
If some specific branch is required for testing please update jmeter-ci yml file and add required branch and commit changes (you can do this from online editor) <br />
http://i.imgur.com/Exe7CRM.png <br />
Changes will be updated after the build is triggered. You can trigger build by: <br />
git commit --allow-empty -m "Trigger Build" <br />
git push origin branch_name


## Prerequisites:
To perform Jmeter tests please install docker on your machine.

Clone repository and execute following commands:

## Build an image

**docker pull registry.dev20bet.com/itlabs22/jmeter:v0.0.1**

## If your local system is Linux. Run image in interactive mode to enter inside the Jmeter container 

Execute from downloaded repository folder

**docker run -it -v $(pwd)/test:/opt/apache-jmeter-5.4.3/bin/test -v $(pwd)/test/output/:/opt/apache-jmeter-5.4.3/bin/output {provide IMAGE ID}**

to get image id list your images with: docker images

## If your local system is Windows. Run image in interactive mode to enter inside the Jmeter container Use command prompt:

Execute from downloaded repository folder

**docker run -it -v %cd%/test:/opt/apache-jmeter-5.4.3/bin/test -v %cd%/test/output/:/opt/apache-jmeter-5.4.3/bin/output {provide IMAGE ID}**

to get image id list your images with: docker images

## Navigate to test execution folder 

**cd /opt/apache-jmeter-5.4.3/bin/test**

## Execute tests:

- BET_20.sh - This test perform bets on staging 20bet. You can provide amount of users and duration as a sh parameters as so: "BET_20.sh 1 1". This will execute test with 1 thread for 1 minute. Default 40 1 
- WEB_20.sh - This test perform navigation on staging 20bet web. You can provide amount of users and duration as a sh parameters as so: "WEB_20.sh 1 1". This will execute test with 1 thread for 1 minute. Default 40 1 
- WEB_BO_20.sh - This test perform navigation on staging 20bet web and ONE thread in backoffice. You can provide amount of users and duration as a sh parameters as so: "WEB_BO_20.sh 1 1". This will execute test with 1 thread for 1 minute. Default 40 1 
- HellSpin_staging.sh - This test perform casino bets on staging hellspin. You can provide amount of users and duration as a sh parameters as so: "HellSpin_staging.sh 1 1". This will execute test with 1 thread for 1 minute. Default 1 2
- CA_BET_20.sh his test perform casino bets on staging 20bet. You can provide amount of users and duration as a sh parameters as so: "CA_BET_20.sh 1 1". This will execute test with 1 thread for 1 minute. Default 1 2

After the is executed your local directory should contain an output folder that will store an test execution report. Each test will generate an folder named as test case. Each test case folder will contain an execution folder named as execution date and time.

| PROD | TEST | parameters | parameters |
| ------ | ------ | ------ | ------ |
| 20 | sh PROD_20.sh | time in minutes | 1 user jmeter.performance@jmeter.com |
| IVIBET | sh PROD_IVIBET.sh | time in minutes | 1 user jmeter.performance@jmeter.com |
| TONYBET | sh PROD_TONYBET.sh | time in minutes (additional user email) | 2 users jmeter.performance@jmeter.com, canada@test.com, artjoms.mohorins@softlabs.com |
| NC | sh PROD_NC.sh | time in minutes | 1 user jmeter.performance@jmeter.com |
| HELLSPIN | sh PROD_HELLSPIN.sh | time in minutes | 1 user jmeter.performance@jmeter.com |
| BIZZO | sh PROD_BIZZO.sh | time in minutes | 1 user jmeter.performance@jmeter.com |

*from 08.07.2022 the BO_WEB_20.sh are executed daily via cron job https://plat22.atlassian.net/browse/IN-1402

## Troubleshooting:

** Windows **

**Problem**: 
Cannot execute tests. Error message: not foundline 2.... This is due to Windows document converter
http://i.imgur.com/tTrNtPz.png

**Resolution**:
Open your execution script in the notepad++ and change the document format to Unix (LF). Save
http://i.imgur.com/8h4ZImP.png

## Tips:

Updated Java version and cannot run jmeter.sh? 
- https://bz.apache.org/bugzilla/show_bug.cgi?id=65388
& probably you are facing this? 
- https://bz.apache.org/bugzilla/show_bug.cgi?id=65300
