Learning KarmaJS

We have explored Jasmine, which basically is a testing framework powered with a cool syntax and functions that help us write the test scripts for our application; in order to execute our test, we had to execute them manually and wait until this finished to see how many tests passed and how many failed.

Karma is a test runner. A test runner is a tool that is configured to look for the test scripts of our application, execute the tests automatically, and export the result of our testing. As we are creating web components with Aurelia, we will need to test our application in different browsers with different characteristics, and as web browsers are different in many ways, we need a way to test our web application in all possible browsers to ensure that our users won't face any problem with our app.

Karma is able to use any testing framework to implement tests. As we have learned Jasmine, we will be using it to write our test scripts, and we will be using Karma to pick up the test files, execute them, and export the results. The following illustrates the flow:

We will see the power of KarmaJS later in this chapter; just keep in mind that Aurelia uses Karma as its test runner for all the projects that you create using the Aurelia CLI, as discussed in Chapter 1, Introducing Aurelia.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset