Javascript unit testing with Karma
We've prepared an example with full TestingBot integration which is easy to set up and run.
With our integrated karma-testingbot-launcher
, you can easily run tests with Karma on TestingBot.
Our launcher will automatically start/stop a tunnel and report back the test results to us.
Installing the example
Make sure you have installed both git
and NodeJS
.
Then proceed to clone our karma-testingbot-example with the follow commands:
git clone https://github.com/testingbot/karma-testingbot-example.git
cd karma-testingbot-example
Once that's installed, please run the follow command to set up the example:
sudo npm install -g karma-cli && npm install
Run Karma test with our karma-testingbot-launcher plugin
In the example's directory, you'll find a file karma.conf-testingbot.js
which contains a "customLaunchers" variable with multiple browsers defined. This is the place where you specify on which browsers you want your test to run.
To actually run the test on TestingBot, we first need to specify the TESTINGBOT_KEY
and TESTINGBOT_SECRET
environment variables, which you can find in our member area.
export TESTINGBOT_KEY=YOUR_KEY
export TESTINGBOT_SECRET=YOUR_SECRET
Now you're ready to run the test on TestingBot.
To start the test, run the following command:
karma start karma.conf-testingbot.js
This will download and start our TestingBot Tunnel, run your test and report back the result.