This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from shubhamarora/master
adding support for custom templates
- Loading branch information
Showing
49 changed files
with
2,717 additions
and
17 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
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
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
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
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
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,66 @@ | ||
package com.yourcompany.perf.yourservice | ||
|
||
// Generated by Replay Zero at {{ now }} | ||
|
||
import io.gatling.core.Predef._ | ||
import io.gatling.core.structure.ScenarioBuilder | ||
import io.gatling.http.Predef._ | ||
import io.gatling.http.protocol.HttpProtocolBuilder | ||
|
||
class YourServiceBaseline extends Simulation { | ||
|
||
val TP99_RESPONSE_TIME = 1600 | ||
val TP90_RESPONSE_TIME = 800 | ||
val TP50_RESPONSE_TIME = 600 | ||
val AVAILABILITY_RATE = 99 | ||
|
||
val testDuration: Integer = java.lang.Integer.getInteger("duration", 10) | ||
val rampDuration: Integer = java.lang.Integer.getInteger("ramp", 2) | ||
require(rampDuration > 0, "Ramp duration must be a natural number!") | ||
|
||
val steadyStateDuration: Integer = testDuration.intValue() - rampDuration.intValue() | ||
require(steadyStateDuration > 0, "Total test duration must be greater than ramp duration!") | ||
|
||
val initialTps: Int = java.lang.Integer.getInteger("initial", 5) | ||
val steadyStateTps: Int = java.lang.Integer.getInteger("steady", 100) | ||
val host: String = System.getProperty("host", "TODO: put your service's base URL here") | ||
val httpProtocol: HttpProtocolBuilder = http.baseURL(host) | ||
|
||
{{ range $index, $event := . -}} | ||
val scenario_{{$index}}: ScenarioBuilder = scenario("scenario_{{$index}}") | ||
.exec(http("http_{{$index}}")) | ||
.{{lower $event.HTTPMethod}}("{{$event.Endpoint}}") | ||
{{- if gt (len $event.ReqHeaders) 0}} | ||
.headers( | ||
{{- range $h_index, $header := $event.ReqHeaders}} | ||
{{- if $h_index -}},{{end}} | ||
"{{$header.Name}}" = "{{$header.Value}}" | ||
{{- end}} | ||
) | ||
{{- end}} | ||
{{- if $event.ReqBody}} | ||
.body(StringBody( | ||
""" | ||
{{ $event.ReqBody }} | ||
""" | ||
)){{- end }} | ||
|
||
{{ end -}} | ||
{{- println -}} | ||
setUp( | ||
{{- $toSkip := sub (len .) 1}} | ||
{{- range $index, $event := . }} | ||
scenario_{{$index}}.inject(rampUsersPerSec(initialTps) to steadyStateTps during (rampDuration minutes), | ||
constantUsersPerSec(steadyStateTps) during (steadyStateDuration minutes)){{if ne $index $toSkip }},{{end}} | ||
{{- end }} | ||
) | ||
.protocols(httpProtocol) | ||
.assertions( | ||
{{- range $index, $event := . -}} | ||
{{- range $k, $v := dict "1" "99" "2" "90" "3" "50"}} | ||
details("http_{{$index}}").responseTime.percentile{{$k}}.lessThan(TP{{$v}}_RESPONSE_TIME), | ||
{{- end}} | ||
{{- end}} | ||
global.failedRequests.percent.lessThan(100 - AVAILABILITY_RATE) | ||
) | ||
} |
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,34 @@ | ||
# Generated by Replay Zero at {{ now }} | ||
Feature: | ||
|
||
Background: | ||
* url 'http://localhost:8080' | ||
{{ range $index, $event := . }} | ||
Scenario: test scenario {{.PairID}} | ||
Given path '{{ $event.Endpoint }}' | ||
{{/* add request headers if present */ -}} | ||
{{ range $header := $event.ReqHeaders -}} | ||
And header {{$header.Name}} = '{{$header.Value}}' | ||
{{end }} | ||
{{- /* add request body if present */ -}} | ||
{{ if $event.ReqBody -}} | ||
And request | ||
""" | ||
{{ $event.ReqBody }} | ||
""" | ||
{{- end }} | ||
|
||
When method {{ $event.HTTPMethod }} | ||
Then status {{ $event.ResponseCode }} | ||
{{/* assert on response headers if present */ -}} | ||
{{ range $header := $event.RespHeaders -}} | ||
And match header {{$header.Name}} == '{{$header.Value}}' | ||
{{end }} | ||
{{- /* assert on response body if present */ -}} | ||
{{ if $event.RespBody -}} | ||
And match response == | ||
""" | ||
{{ $event.RespBody }} | ||
""" | ||
{{- end }} | ||
{{ end }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.