-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Viet Nguyen Duc <[email protected]>
- Loading branch information
0 parents
commit 0f9d8fb
Showing
11 changed files
with
7,055 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Run JMeter Tests | ||
on: | ||
push: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@main | ||
- name: Set up Node | ||
uses: actions/setup-node@main | ||
with: | ||
node-version: 'latest' | ||
- name: Start server API | ||
working-directory: sample-api | ||
run: | | ||
npm install | ||
npm start & | ||
- name: Run JMeter Tests | ||
uses: QAInsights/PerfAction@master | ||
with: | ||
test-plan-path: jmeter-files/test-plan.jmx | ||
args: "-Jdomain=localhost -Jport=6060 -Jnum_threads=3000 -e -f -l reports/result.jtl -o reports" | ||
- name: Upload Results | ||
uses: actions/upload-artifact@main | ||
with: | ||
name: jmeter-results | ||
path: reports | ||
- name: Publish Results with Latency Lingo | ||
uses: latency-lingo/github-action@main | ||
with: | ||
api-key: ${{ secrets.LATENCY_LINGO_API_KEY }} | ||
file: reports/result.jtl | ||
label: Checkout Flow Automated Test Plan | ||
format: jmeter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
reports | ||
jmeter.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Local runs | ||
|
||
1. Start sample API server | ||
|
||
```bash | ||
cd sample-api | ||
npm install | ||
npm start & | ||
``` | ||
|
||
2. Run tests | ||
|
||
```bash | ||
jmeter -n -t jmeter-files/test-plan.jmx -Jdomain=localhost -Jport=6060 -Jnum_threads=3000 -e -f -l reports/result.jtl -o reports | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jmeter.log | ||
latency-lingo-cli |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.3"> | ||
<hashTree> | ||
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Checkout Flow Test Plan" enabled="true"> | ||
<stringProp name="TestPlan.comments"></stringProp> | ||
<boolProp name="TestPlan.functional_mode">false</boolProp> | ||
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> | ||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | ||
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="TestPlan.user_define_classpath"></stringProp> | ||
</TestPlan> | ||
<hashTree> | ||
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> | ||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> | ||
<boolProp name="LoopController.continue_forever">false</boolProp> | ||
<intProp name="LoopController.loops">-1</intProp> | ||
</elementProp> | ||
<stringProp name="ThreadGroup.num_threads">${__P(num_threads, 50)}</stringProp> | ||
<stringProp name="ThreadGroup.ramp_time">30</stringProp> | ||
<boolProp name="ThreadGroup.scheduler">true</boolProp> | ||
<stringProp name="ThreadGroup.duration">30</stringProp> | ||
<stringProp name="ThreadGroup.delay"></stringProp> | ||
<boolProp name="ThreadGroup.same_user_on_next_iteration">false</boolProp> | ||
</ThreadGroup> | ||
<hashTree> | ||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home page" enabled="true"> | ||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="HTTPSampler.domain">${__P(domain, a110-74-15-23-210.ngrok.io)}</stringProp> | ||
<stringProp name="HTTPSampler.port">${__P(port, 80)}</stringProp> | ||
<stringProp name="HTTPSampler.protocol">http</stringProp> | ||
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
<stringProp name="HTTPSampler.path">/</stringProp> | ||
<stringProp name="HTTPSampler.method">GET</stringProp> | ||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
<stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
</HTTPSamplerProxy> | ||
<hashTree/> | ||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Login" enabled="true"> | ||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="HTTPSampler.domain">${__P(domain, a110-74-15-23-210.ngrok.io)}</stringProp> | ||
<stringProp name="HTTPSampler.port">${__P(port, 80)}</stringProp> | ||
<stringProp name="HTTPSampler.protocol">http</stringProp> | ||
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
<stringProp name="HTTPSampler.path">/login</stringProp> | ||
<stringProp name="HTTPSampler.method">POST</stringProp> | ||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
<stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
</HTTPSamplerProxy> | ||
<hashTree/> | ||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Search items" enabled="true"> | ||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="HTTPSampler.domain">${__P(domain, a110-74-15-23-210.ngrok.io)}</stringProp> | ||
<stringProp name="HTTPSampler.port">${__P(port, 80)}</stringProp> | ||
<stringProp name="HTTPSampler.protocol">http</stringProp> | ||
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
<stringProp name="HTTPSampler.path">/search</stringProp> | ||
<stringProp name="HTTPSampler.method">POST</stringProp> | ||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
<stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
</HTTPSamplerProxy> | ||
<hashTree/> | ||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Add item to cart" enabled="true"> | ||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="HTTPSampler.domain">${__P(domain, a110-74-15-23-210.ngrok.io)}</stringProp> | ||
<stringProp name="HTTPSampler.port">${__P(port, 80)}</stringProp> | ||
<stringProp name="HTTPSampler.protocol">http</stringProp> | ||
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
<stringProp name="HTTPSampler.path">/cart/item</stringProp> | ||
<stringProp name="HTTPSampler.method">POST</stringProp> | ||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
<stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
</HTTPSamplerProxy> | ||
<hashTree/> | ||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout" enabled="true"> | ||
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="HTTPSampler.domain">${__P(domain, a110-74-15-23-210.ngrok.io)}</stringProp> | ||
<stringProp name="HTTPSampler.port">${__P(port, 80)}</stringProp> | ||
<stringProp name="HTTPSampler.protocol">http</stringProp> | ||
<stringProp name="HTTPSampler.contentEncoding"></stringProp> | ||
<stringProp name="HTTPSampler.path">/checkout</stringProp> | ||
<stringProp name="HTTPSampler.method">POST</stringProp> | ||
<boolProp name="HTTPSampler.follow_redirects">true</boolProp> | ||
<boolProp name="HTTPSampler.auto_redirects">false</boolProp> | ||
<boolProp name="HTTPSampler.use_keepalive">true</boolProp> | ||
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> | ||
<stringProp name="HTTPSampler.embedded_url_re"></stringProp> | ||
<stringProp name="HTTPSampler.connect_timeout"></stringProp> | ||
<stringProp name="HTTPSampler.response_timeout"></stringProp> | ||
</HTTPSamplerProxy> | ||
<hashTree/> | ||
</hashTree> | ||
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true"> | ||
<boolProp name="ResultCollector.error_logging">false</boolProp> | ||
<objProp> | ||
<name>saveConfig</name> | ||
<value class="SampleSaveConfiguration"> | ||
<time>true</time> | ||
<latency>true</latency> | ||
<timestamp>true</timestamp> | ||
<success>true</success> | ||
<label>true</label> | ||
<code>true</code> | ||
<message>true</message> | ||
<threadName>true</threadName> | ||
<dataType>true</dataType> | ||
<encoding>false</encoding> | ||
<assertions>true</assertions> | ||
<subresults>true</subresults> | ||
<responseData>false</responseData> | ||
<samplerData>false</samplerData> | ||
<xml>false</xml> | ||
<fieldNames>true</fieldNames> | ||
<responseHeaders>false</responseHeaders> | ||
<requestHeaders>false</requestHeaders> | ||
<responseDataOnError>false</responseDataOnError> | ||
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> | ||
<assertionsResultsToSave>0</assertionsResultsToSave> | ||
<bytes>true</bytes> | ||
<sentBytes>true</sentBytes> | ||
<url>true</url> | ||
<threadCounts>true</threadCounts> | ||
<idleTime>true</idleTime> | ||
<connectTime>true</connectTime> | ||
</value> | ||
</objProp> | ||
<stringProp name="filename">reports/result.csv</stringProp> | ||
</ResultCollector> | ||
<hashTree/> | ||
</hashTree> | ||
</hashTree> | ||
</jmeterTestPlan> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
|
||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const express = require('express') | ||
const bodyParser = require('body-parser'); | ||
|
||
const app = express(); | ||
const port = 6060; | ||
|
||
const withRandomSleep = (min, max, cb) => { | ||
const sleep = Math.floor(Math.random() * (max - min + 1) + min); | ||
setTimeout(cb, sleep); | ||
}; | ||
|
||
app.use(bodyParser.urlencoded({ extended: false })); | ||
app.use(bodyParser.json()); | ||
|
||
app.get('/', (_, res) => { | ||
withRandomSleep(500, 1500, () => { | ||
res.send('Hello World!'); | ||
}); | ||
}); | ||
|
||
app.post('/login', (_, res) => { | ||
withRandomSleep(1000, 3200, () => { | ||
res.json({ | ||
success: true, | ||
message: 'User logged in successfully', | ||
}); | ||
}); | ||
}); | ||
|
||
app.post('/search', (_, res) => { | ||
withRandomSleep(750, 2500, () => { | ||
res.json({ | ||
success: true, | ||
message: 'Search completed successfully', | ||
}); | ||
}); | ||
}); | ||
|
||
app.post('/cart/item', (_, res) => { | ||
withRandomSleep(750, 1750, () => { | ||
res.json({ | ||
success: true, | ||
message: 'Item added to cart', | ||
}); | ||
}); | ||
}); | ||
|
||
app.post('/checkout', (req, res) => { | ||
withRandomSleep(1500, 4500, () => { | ||
res.json({ | ||
success: true, | ||
message: 'Order created', | ||
}); | ||
}); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Hello world app listening on port ${port}!`); | ||
}); | ||
|
Oops, something went wrong.