|
| 1 | +# Performance Testing for Topcoder Connect App |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Topcoder Connect is a web application that makes it easy to tap into the power of crowdsourcing to get more work done faster. Connect is ideal for projects that include application design and/or development work. You can crowdsource the entire application development lifecycle or just the specific stages where you need help. Common deliverables include application wireframes, UI/UX designs, prototypes, MVPs, and production-ready apps for any kind of device—mobile, wearables, or the web. |
| 6 | + |
| 7 | +## Dependencies |
| 8 | + |
| 9 | +- Jmeter maven plugin 2.9.0 |
| 10 | +- Maven 3.5.2 |
| 11 | +- JDK between 8 and 11 |
| 12 | + |
| 13 | +## Prerequisite |
| 14 | + |
| 15 | +- We have already included the workflow into the circleci conf file with the usual dev builds. |
| 16 | + |
| 17 | +## Directory Structure |
| 18 | + |
| 19 | +- .circleci (Circleci configuration file) |
| 20 | +- \src\test\jmeter - Includes the JMX file(s) and CSV data files |
| 21 | +- pom file |
| 22 | + |
| 23 | +### **Setup and Runtime** |
| 24 | + |
| 25 | +Add the plugin to your project: Add the plugin to the build section of your pom's project |
| 26 | + |
| 27 | +``` |
| 28 | +<plugin> |
| 29 | + <groupId>com.lazerycode.jmeter</groupId> |
| 30 | + <artifactId>jmeter-maven-plugin</artifactId> |
| 31 | + <version>3.2.0</version> |
| 32 | + <executions> |
| 33 | + <!-- Generate JMeter configuration --> |
| 34 | + <execution> |
| 35 | + <id>configuration</id> |
| 36 | + <goals> |
| 37 | + <goal>configure</goal> |
| 38 | + </goals> |
| 39 | + </execution> |
| 40 | + <!-- Run JMeter tests --> |
| 41 | + <execution> |
| 42 | + <id>jmeter-tests</id> |
| 43 | + <goals> |
| 44 | + <goal>jmeter</goal> |
| 45 | + </goals> |
| 46 | + </execution> |
| 47 | + <!-- Fail build on errors in test --> |
| 48 | + <execution> |
| 49 | + <id>jmeter-check-results</id> |
| 50 | + <goals> |
| 51 | + <goal>results</goal> |
| 52 | + </goals> |
| 53 | + </execution> |
| 54 | + </executions> |
| 55 | +</plugin> |
| 56 | +``` |
| 57 | + |
| 58 | +This simple load test is already integrated with the current build process |
| 59 | + |
| 60 | +``` |
| 61 | +workflows: |
| 62 | + version: 2 |
| 63 | + Connect Project Services: |
| 64 | + jobs: |
| 65 | + - build: |
| 66 | + context : org-global |
| 67 | + - deployDev: |
| 68 | + context : org-global |
| 69 | + requires: |
| 70 | + - build |
| 71 | + filters: |
| 72 | + branches: |
| 73 | + only: ['develop'] |
| 74 | + - deployProd: |
| 75 | + context : org-global |
| 76 | + requires: |
| 77 | + - build |
| 78 | + filters: |
| 79 | + branches: |
| 80 | + only: ['master'] |
| 81 | + - Hold [Performance-Testing]: |
| 82 | + type: approval |
| 83 | + requires: |
| 84 | + - build |
| 85 | + - deployDev |
| 86 | + - deployProd |
| 87 | + - Connect-Performance-Testing: |
| 88 | + requires: |
| 89 | + - Hold [Performance-Testing] |
| 90 | +``` |
| 91 | + |
| 92 | +- Hold [Performance-Testing] - This is the approval job we needs manual interaction. |
| 93 | +- It requires `build`, `deployDev` and `deployProd` jobs to run first. |
| 94 | +- Actual performance testing job is `Connect-Performance-Testing` and it requires `Hold [Performance-Testing]` job to finish. |
| 95 | + |
| 96 | +### **Configuration** |
| 97 | + |
| 98 | +<img src="https://imgur.com/0WNB89y.png" alt=""> |
| 99 | +<img src="https://imgur.com/rdP3t77.png" alt=""> |
| 100 | + |
| 101 | +This performance test is for 15 virtual users. The parameters for this test plan is as below; |
| 102 | + |
| 103 | +- Start Thread Count |
| 104 | +- Initial Deplay, sec (Startup Time + Hold Load For) |
| 105 | +- Startup Time, sec (Start Thread Count = Startup Time) |
| 106 | +- Hold Load For, sec |
| 107 | +- Shutdown Time (Next row `Initial Deplay`) |
| 108 | + |
| 109 | +**Formulas:** |
| 110 | + |
| 111 | +``` |
| 112 | +Initial time of a record = initialtime + start up time/ramp-up time + holdtime of the previous record |
| 113 | +``` |
| 114 | + |
| 115 | +``` |
| 116 | +start up time/ramp-up time = Shutdown time/ramp-down time of the previous record |
| 117 | +``` |
| 118 | + |
| 119 | +This setup is configured to run 6min with 15 UVs. |
| 120 | + |
| 121 | +**Token Details** |
| 122 | + |
| 123 | +- `audience` - https://m2m.topcoder-dev.com/ |
| 124 | +- `grant_type` - client_credentials |
| 125 | +- `content-type` - application/json |
| 126 | +- `client_id` - jGIf2pd3f44B1jqvOai30BIKTZanYBfU |
| 127 | +- `client_secret` - ldzqVaVEbqhwjM5KtZ79sG8djZpAVK8Z7qieVcC3vRjI4NirgcinKSBpPwk6mYYP |
| 128 | + |
| 129 | +To extract the token we are using the variable `access_token` |
| 130 | + |
| 131 | +TO pass the `access_token` varaible globally we are using the beanshell Assertion |
| 132 | + |
| 133 | +`${__setProperty(access_token, ${access_token})};` |
| 134 | + |
| 135 | +**Random Controller** |
| 136 | + |
| 137 | +We are using Random Controller to randomize the requests sent to the server to simulate the different request. |
| 138 | + |
| 139 | +**Think Time** |
| 140 | + |
| 141 | +We are using this parameter to implement a random wait time in betweent the request to simulate the real user experience. |
| 142 | + |
| 143 | +**HTTP Requets** |
| 144 | + |
| 145 | +- Access Tabs - Simulate user accessing different tabs |
| 146 | +- Access Projects - Simulate user accessing different projetcs |
| 147 | +- Assets Library (Link Insert) - Add Links to the projects |
| 148 | + |
| 149 | +## Check the reports and data |
| 150 | + |
| 151 | +After running the job using the circleci user can view the report by clicking on the Job: `Connect-Performance-Testing` > Artifacts > `target/jmeter/reports/15UV Ultimate Thread-Group/index.html` |
| 152 | + |
| 153 | +eg: https://2728-60865675-gh.circle-artifacts.com/0/target/jmeter/reports/15UV%20Ultimate%20Thread-Group/index.html |
0 commit comments