-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT: Revamp "Writing realistic tests" page #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small suggestions, I realize you aren't quite finished with updating the code examples.
Questions: Is this the best format for teaching these concepts? Is it easy enough to find this tutorial if you want to learn about these topics? Possible alternatives:
- divide up into more than 1 tutorial/guide
- rename to make the topic(s) clearer
Just food for thought
content/tutorials/advanced/index.md
Outdated
@@ -25,9 +25,10 @@ This way, you'll be able to easily reuse some parts and build complex behaviors | |||
|
|||
In our scenario we have three separated processes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our scenario we have three separated processes: | |
In our scenario, we have four separated processes: |
content/tutorials/advanced/index.md
Outdated
1. First we create a Feeder from a csv file with the following columns: *searchCriterion*, *searchComputerName*. | ||
2. As the default Feeder strategy is *queue*, we will use the *random* strategy for this test to avoid feeder starvation. | ||
1. First we create a Feeder from a csv file with the following columns: _searchCriterion_, _searchProductName_. | ||
2. As the default Feeder strategy is _queue_, we will use the _random_ strategy for this test to avoid feeder starvation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. As the default Feeder strategy is _queue_, we will use the _random_ strategy for this test to avoid feeder starvation. | |
2. As the default Feeder strategy is `queue`, we will use the `random` strategy for this test to avoid feeder starvation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I think using the code ticks is more consistent with the rest of the docs. I didn't try to fix this everywhere.
e8c3989
to
1b3e7e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Extra Indentations need to be rechecked and removed if needed.
- Parent classes need to be removed from snippets in order to reduce noise and align all code snippets.
- Missing reference links from Kotlin snippets.
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleScala.scala
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleKotlin.kt
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleKotlin.kt
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleKotlin.kt
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleKotlin.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
Co-authored-by: Karim Atwa <[email protected]>
// Define scenario 1 with a random traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | ||
static final ScenarioBuilder scn1 = scenario("Scenario 1") | ||
.exitBlockOnFail() | ||
.on( | ||
randomSwitch() | ||
.on( | ||
percent(70) | ||
.then( | ||
group("fr") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)), | ||
percent(30) | ||
.then( | ||
group("us") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)))) | ||
.exitHereIfFailed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
static final ScenarioBuilder scn1 = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed(); | |
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
static final ScenarioBuilder scn1 = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed(); |
// Define scenario 2 with a uniform traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | ||
static final ScenarioBuilder scn2 = scenario("Scenario 2") | ||
.exitBlockOnFail() | ||
.on( | ||
uniformRandomSwitch() | ||
.on( | ||
group("fr") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy), | ||
group("us") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy))) | ||
.exitHereIfFailed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
static final ScenarioBuilder scn2 = scenario("Scenario 2") | |
.exitBlockOnFail() | |
.on( | |
uniformRandomSwitch() | |
.on( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed(); | |
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
static final ScenarioBuilder scn2 = scenario("Scenario 2") | |
.exitBlockOnFail() | |
.on( | |
uniformRandomSwitch() | |
.on( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed(); |
// Define scenario 1 with a random traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | ||
static final ScenarioBuilder scn1 = scenario("Scenario 1") | ||
.exitBlockOnFail() | ||
.on( | ||
randomSwitch() | ||
.on( | ||
percent(70) | ||
.then( | ||
group("fr") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)), | ||
percent(30) | ||
.then( | ||
group("us") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)))) | ||
.exitHereIfFailed(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
static final ScenarioBuilder scn1 = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed(); | |
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
static final ScenarioBuilder scn1 = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed(); |
// Define scenario 1 with a random traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | ||
val scn1: ScenarioBuilder = scenario("Scenario 1") | ||
.exitBlockOnFail() | ||
.on( | ||
randomSwitch() | ||
.on( | ||
percent(70.0) | ||
.then( | ||
group("fr") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)), | ||
percent(30.0) | ||
.then( | ||
group("us") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy)))) | ||
.exitHereIfFailed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
val scn1: ScenarioBuilder = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70.0) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30.0) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed() | |
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
val scn1: ScenarioBuilder = scenario("Scenario 1") | |
.exitBlockOnFail() | |
.on( | |
randomSwitch() | |
.on( | |
percent(70.0) | |
.then( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)), | |
percent(30.0) | |
.then( | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy)))) | |
.exitHereIfFailed() |
// Define scenario 2 with a uniform traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | ||
val scn2: ScenarioBuilder = scenario("Scenario 2") | ||
.exitBlockOnFail() | ||
.on( | ||
uniformRandomSwitch() | ||
.on( | ||
group("fr") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy), | ||
group("us") | ||
.on( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy))) | ||
.exitHereIfFailed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
val scn2: ScenarioBuilder = scenario("Scenario 2") | |
.exitBlockOnFail() | |
.on( | |
uniformRandomSwitch() | |
.on( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed() | |
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
val scn2: ScenarioBuilder = scenario("Scenario 2") | |
.exitBlockOnFail() | |
.on( | |
uniformRandomSwitch() | |
.on( | |
group("fr") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us") | |
.on( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed() |
// Define scenario 1 with a random traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | ||
private val scn1: ScenarioBuilder = scenario("Scenario 1") | ||
.exitBlockOnFail( | ||
randomSwitch( | ||
70.0 -> group("fr")( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy), | ||
30.0 -> group("us")( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy))) | ||
.exitHereIfFailed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
private val scn1: ScenarioBuilder = scenario("Scenario 1") | |
.exitBlockOnFail( | |
randomSwitch( | |
70.0 -> group("fr")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
30.0 -> group("us")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed | |
// Define scenario 1 with a random traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#randomswitch | |
private val scn1: ScenarioBuilder = scenario("Scenario 1") | |
.exitBlockOnFail( | |
randomSwitch( | |
70.0 -> group("fr")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
30.0 -> group("us")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed |
// Define scenario 2 with a uniform traffic distribution | ||
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | ||
private val scn2: ScenarioBuilder = scenario("Scenario 2") | ||
.exitBlockOnFail( | ||
uniformRandomSwitch( | ||
group("fr")( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy), | ||
group("us")( | ||
homeAnonymous, | ||
pause(5, 15), | ||
authenticate, | ||
homeAuthenticated, | ||
pause(5, 15), | ||
addToCart, | ||
pause(5, 15), | ||
buy))) | ||
.exitHereIfFailed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
private val scn2: ScenarioBuilder = scenario("Scenario 2") | |
.exitBlockOnFail( | |
uniformRandomSwitch( | |
group("fr")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed | |
// Define scenario 2 with a uniform traffic distribution | |
// Reference: https://docs.gatling.io/reference/script/core/scenario/#uniformrandomswitch | |
private val scn2: ScenarioBuilder = scenario("Scenario 2") | |
.exitBlockOnFail( | |
uniformRandomSwitch( | |
group("fr")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy), | |
group("us")( | |
homeAnonymous, | |
pause(5, 15), | |
authenticate, | |
homeAuthenticated, | |
pause(5, 15), | |
addToCart, | |
pause(5, 15), | |
buy))) | |
.exitHereIfFailed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it better to have the page url match its content and title? Doesn't it have an impact on SEO?
Should we keep "advanced" or rename the folder and files? cc @stb13579
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleJava.java
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleScala.scala
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleScala.scala
Outdated
Show resolved
Hide resolved
content/tutorials/advanced/code/AdvancedTutorialSampleScala.scala
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.