All Projects → grafana → k6-template-typescript

grafana / k6-template-typescript

Licence: other
Template to use TypeScript with k6

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to k6-template-typescript

k6-template-es6
Template repository for bundling test projects into single test scripts runnable by k6
Stars: ✭ 39 (-56.67%)
Mutual labels:  templates, load-testing, performance-testing, k6
postman-to-k6
Converts Postman collections to k6 script code
Stars: ✭ 269 (+198.89%)
Mutual labels:  load-testing, performance-testing, k6
jmeter-to-k6
Converts JMeter .jmx files to k6 JS code
Stars: ✭ 57 (-36.67%)
Mutual labels:  load-testing, performance-testing, k6
k6-action
k6 is now available as a GitHub Action
Stars: ✭ 64 (-28.89%)
Mutual labels:  load-testing, performance-testing, k6
ultron
new repository: https://github.com/wosai/ultron
Stars: ✭ 15 (-83.33%)
Mutual labels:  load-testing, performance-testing
k6-reporter
Output K6 test run results as formatted & easy to read HTML reports
Stars: ✭ 160 (+77.78%)
Mutual labels:  load-testing, k6
mzbench
Distributed Benchmarking
Stars: ✭ 39 (-56.67%)
Mutual labels:  load-testing, performance-testing
k6-operator
An operator for running distributed k6 tests.
Stars: ✭ 170 (+88.89%)
Mutual labels:  load-testing, performance-testing
k6-example-data-generation
Example repository showing how to utilise k6 and faker to load test using generated data
Stars: ✭ 32 (-64.44%)
Mutual labels:  load-testing, performance-testing
load-testing-toolkit
Collection of open-source tools for debugging, benchmarking, load and stress testing your code or services.
Stars: ✭ 65 (-27.78%)
Mutual labels:  load-testing, performance-testing
gatf
Generic Automated Test Framework For API/UI/RPA/Load Testing
Stars: ✭ 15 (-83.33%)
Mutual labels:  load-testing, performance-testing
awesome-locust
A collection of resources covering different aspects of Locust load testing tool usage.
Stars: ✭ 40 (-55.56%)
Mutual labels:  load-testing, performance-testing
awesome-gatling
A collection of resources covering different aspects of Gatling load-testing tool usage.
Stars: ✭ 36 (-60%)
Mutual labels:  load-testing, performance-testing
XLT
XLT is an comprehensive load and performance test tool developed and maintained by Xceptance.
Stars: ✭ 39 (-56.67%)
Mutual labels:  load-testing, performance-testing
chef-load
chef-load - a tool for simulating load on a Chef Infra Server and/or a Chef Automate server
Stars: ✭ 30 (-66.67%)
Mutual labels:  load-testing, performance-testing
f1
A tool for writing load test scenarios in Golang with a powerful command line runner
Stars: ✭ 81 (-10%)
Mutual labels:  load-testing, performance-testing
Element
💦Load test your app using real web browsers
Stars: ✭ 204 (+126.67%)
Mutual labels:  load-testing, performance-testing
ddosify
High-performance load testing tool, written in Golang.
Stars: ✭ 3,788 (+4108.89%)
Mutual labels:  load-testing, performance-testing
bounded-disturbances
A k6/.NET red/green load testing workshop
Stars: ✭ 39 (-56.67%)
Mutual labels:  load-testing, k6
k6-example-github-actions
No description or website provided.
Stars: ✭ 18 (-80%)
Mutual labels:  load-testing, performance-testing

banner

Template to use TypeScript with k6

.github/workflows/push.yml

This repository provides a scaffolding project to start using TypeScript in your k6 scripts.

Rationale

While JavaScript is great for a myriad of reasons, one area where it fall short is type safety and developer ergonomics. It's perfectly possible to write JavaScript code that will look OK and behave OK until a certain condition forces the executor into a faulty branch.

While it, of course, still is possible to shoot yourself in the foot with TypeScript as well, it's significantly harder. Without adding much overhead, TypeScript will:

  • Improve the ability to safely refactor your code.
  • Improve readability and maintainability.
  • Allow you to drop a lot of the defensive code previously needed to make sure consumers are calling functions properly.

Prerequisites

Installation

Creating a project from the template-typescript template

To generate a TypeScript project that includes the dependencies and initial configuration, navigate to the template-typescript page and click Use this template.

Install dependencies

Clone the generated repository on your local machine, move to the project root folder and install the dependencies defined in package.json

$ yarn install

Running the test

To run a test written in TypeScript, we first have to transpile the TypeScript code into JavaScript and bundle the project

$ yarn webpack

This command creates the final test files to the ./dist folder.

Once that is done, we can run our script the same way we usually do, for instance:

$ k6 run dist/get-200-status-test.js

Writing own tests

House rules for writing tests:

  • The test code is located in src folder
  • The entry points for the tests need to have "test" word in the name to distinguish them from auxiliary files. You can change the entry here.
  • If static files are required then add them to ./assets folder. Its content gets copied to the destination folder (dist) along with compiled scripts.

Transpiling and Bundling

By default, k6 can only run ES5.1 JavaScript code. To use TypeScript, we have to set up a bundler that converts TypeScript to JavaScript code.

This project uses Babel and Webpack to bundle the different files - using the configuration of the webpack.config.js file.

If you want to learn more, check out Bundling node modules in k6.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].