Karma testing with code coverage for Oracle JET part 1. by Cindy Berghuizen


This is the first blog in a series of two blogs about Karma testing (with code coverage) for Oracle JET. This first blog will help you with setting up the files in the project to get karma up and running. The second blog can be found here and will show you how to actually test your code in the viewModels.

Start a new project.

First we start our new Oracle JET project following the example on the Oracle JET website.

Now check if your project is working by running:

Next step is to add all the npm modules for karma, jasmine and supporting coverage reports.

Add a directory named test, this is where the testfiles will be. Add a file named test-main.js in the directory and leave it empty for now.

Karma Configuration.

Go back to the main directory of your project. Next step is to make the configurations for karma, I do this using

The framework we are using is Jasmine, we do need the Require.js plugin so answer yes for that question. I use Chrome as a browser but you can pick whatever browser you like. All the other questions I left empty or answered with “no”.

Open the karma.conf.js and add the libraries, viewModel, testfiles and the test-main file to files. Read the complete article here.

WebLogic Partner Community

For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.

Blog Twitter LinkedIn Forum Wiki

Technorati Tags: WebLogic Community,Oracle,OPN,Jürgen Kress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.