- Author: [[Ivan Mirić]]
- Full Title: Testing Without Limits: Xk6 and K6 Extensions
- Tags:: [[k6 (Company)]] [[k6 (tool)]] [[xk6]]
- URL: https://k6.io/blog/extending-k6-with-xk6
- ### Highlights first synced by [[Readwise]] [[2020-12-08]]
- Go-based k6 extensions and import them as JS modules in your k6 script. ([View Highlight](https://instapaper.com/read/1367348480/14806972))
- Before this release, importing JavaScript libraries was the only possibility to extend k6. While this approach works in many cases, it has two significant limitations:
lack of JS support for system APIs.
performance penalties due to the JS runtime. ([View Highlight](https://instapaper.com/read/1367348480/14806977))
- Extensions allow the community to innovate and enable faster development ([View Highlight](https://instapaper.com/read/1367348480/14806984))
- Merging a change that could potentially affect thousands of other k6 users or introduce maintenance overheads is always a difficult proposition that k6 maintainers are very cautious about, which in some cases can cause delays in introducing new features. ([View Highlight](https://instapaper.com/read/1367348480/14806988))
- xk6 is an experimental framework for extending k6 that allows you to build a custom k6 binary by adding any combination of extensions easily, without any need to know how to code. For example, building a k6 v0.29.0 binary that allows you to use the SQL and Kafka extensions in your test scripts is as simple as:
$ xk6 build v0.29.0 \
--with github.com/imiric/xk6-sql \
--with github.com/mostafa/xk6-kafka ([View Highlight](https://instapaper.com/read/1367348480/14806994))
- This will build a k6 binary you can then use to run custom scripts that use the additional functionality.
$ ./k6 run some-script-with-sql-and-kafka.js ([View Highlight](https://instapaper.com/read/1367348480/14806997))