Test Automation with Kafka - Set up the AVA Test Framework
Introduction
We’re going to use AVA as our chosen test runner. AVA takes advantage of asynchronous functions and runs your tests concurrently. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file.
Setup
Install and setup AVA -
npx create-ava --next
.Within your directory, you should have a very basic
package.json
file now configured. This is similar to yourpom.xml
in Java, used by Maven to build the project.Create a file named
test.js
. AVA defaults to the following patternstest.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js
, so it will run your test file without any additional configuration.Within your test file, you need to import the test function from AVA. You can then create your first test scaffold.
import test from 'AVA; test('Your test name', t => { });
Our test framework is now ready to have Kafka integrated into.