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

  1. Install and setup AVA - npx create-ava --next.

  2. Within your directory, you should have a very basic package.json file now configured. This is similar to your pom.xml in Java, used by Maven to build the project.

  3. Create a file named test.js. AVA defaults to the following patterns test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js, so it will run your test file without any additional configuration.

  4. 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  => {
        
    });
    
  5. Our test framework is now ready to have Kafka integrated into.

comments powered by Disqus