Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SwissLife-OSS/K6-MultiScenario-template
A K6 Multi Scenario template applying some best practices along some examples
https://github.com/SwissLife-OSS/K6-MultiScenario-template
Last synced: about 1 month ago
JSON representation
A K6 Multi Scenario template applying some best practices along some examples
- Host: GitHub
- URL: https://github.com/SwissLife-OSS/K6-MultiScenario-template
- Owner: SwissLife-OSS
- License: mit
- Created: 2021-06-16T12:08:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-08T06:51:12.000Z (over 3 years ago)
- Last Synced: 2024-04-23T02:21:58.706Z (8 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 51
- Watchers: 8
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-k6 - SwissLife-OSS/k6-multiscenario-template - Use K6 to implement a Multi Scenario template. (Examples/Templates)
- awesome-k6 - SwissLife-OSS/k6-multiscenario-template - Use K6 to implement a Multi Scenario template. (Examples/Templates)
README
# K6-Multi-Scenario-Template
It is a performance testing template that shows how to use K6 to implement a Multi Scenario template applying some best practices along some examples.## Getting Started
Clone the code, [install K6](https://k6.io/docs/getting-started/installation/) and run the k6_multi_scenario_executor.bat and watch the outcome.
then learn the basics of K6, there are some code snippets for the main concepts (lifetime, VUs, Duration, checks, Thresholds, Stages, Executors, Scenarios).
And once you are familiar with them, go and look the K6_multi_scenario_template.js file which is the k6 template, and modify it to match your SUT (System Under Test).## Features
The purpose of this project is to show how to put all the K6 techniques together while:
- Applying some best practices.
- Enabling a multiple test type execution (load, smoke, soak, stress...)
- Enabling multiple scenario execution (understanding scenario as one concrete way to interact with a server). Ie, if it is a todo server we would like to:
- login
- logout
- register
- enter a new task
- enter several tasks
- retrieve the tasks for the day
- delete a task
- Enabling a secure code without secrets on it, and ready to integrate in a CI-CD pipeline without surprises.
- Show how to implement the most common tasks (register, login, retrieve token, access REST api, access GraphQL api, retrieve and verify a web page).
- show how to create and use tags & groups.
- Show how to mix different Scenario executors (Ramping VUs & Ramping Arrival Rate)The BackendFlowTest and the BackendReadTest as well as the Setup have been taken from the 'Advanced API Flow' example, located at [fabulous example section of k6.io](https://k6.io/docs/examples/advanced-api-flow/), with some modifications. All the credit is theirs :)
## Usage
To try it out, just open a command line with cmd.exe in windows in the root folder and type 'k6_multi_scenario_executor.bat'
It should execute the smoke test which will run several scenarios:
- BackendRead_scenario, will read some information from a k6 test REST endpoint.
- BackendFlow_scenario, will execute a complex scenario againsta k6 test REST endpoint.
- Frontend_scenario, will retrieve the k6.io page and check some of its content.
- GraphQL_scenario, will access the Rick & Morty GraphQL API, retrieve all the human characters and do some checks.Please note that https://rickandmortyapi.com/ is not meant for testing, so the usage in the code is limited to a single VU, so this does not cause a DOS attack to them.
So, please, be kind.## Contribution
If you have an idea or suggestion, create an issue or, even better, implement it in a PR so we can improve it and add more functionality.## Community
This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org/)
to clarify expected behavior in our community. For more information, see the [Swiss Life OSS Code of Conduct](https://swisslife-oss.github.io/coc).