LambdaTestAutomation Testing ● Jasmine Test Runner: Run Jasmine Testing on LambdaTest Selenium Grid

Jasmine Test Runner: Run Jasmine Testing on LambdaTest Selenium Grid

This topic will help you demonstrate:

  • How to run a Jasmine testing and Selenium testing script on LambdaTest Selenium Cloud with Karma test runner for Angular?
  • How to test your locally hosted pages using Jasmine test runner?
  • How to run your test cases in parallel to reduce build times?
  • How to leverage LambdaTest’s Advanced capabilities?

Jasmine Testing using Jasmine Test Runner

Jasmine test runner is a BDD test automation framework which helps you to write clean and powerful test cases for JavaScript. It executes independently with respect to DOM or other JavaScript frameworks. Visit the official website to learn more Jasmine test runner.

Karma Test Runner

Developed by AngularJS team, Karma is a Javascript test runner that helps to evaluate your source code across different browsers on the basis of your test code. The results are displayed using CLI to represent the test’s pass/fail status on various browsers. To know more refer to the Karma’s official website.


LambdaTest Selenium Automation Grid is a cloud-based, scalable Selenium testing platform which enables you to run your automation scripts on 2000+ different browsers and operating systems. You can now run your java Selenium automated test cases on a scalable Selenium infrastructure that is running real browsers and real operating systems.

Prerequisites For Running Karma With Our Online Selenium Grid

In order to perform your karma tests with LambdaTest, you would need the below things to be already set up:

Global Dependencies

  • Make sure to use the latest version of JavaScript.
  • A Git or GitHub repository
  • Download and install node.js and node package manager or npm.
    To install node.js with homebrew use the below command.
  • Install node.js with Homebrew

  • If you have npm already installed, you may want to upgrade it to latest version. Here the code you can run in your terminal to upgrade npm.

    Upgrade npm to latest version

LambdaTest Authentication Credentials

Be aware of your LambdaTest authentication credentials i.e. your LambdaTest username, access key and HubURL. You need to set them up as your environment variables. You can retrieve them from your LambdaTest automation dashboard by clicking on the key icon near the help button.

  • For Linux/Mac:
  • For Windows:

Setting Up The Environment for Jasmine Testing using Selenium

You need to clone our GitHub repository which demonstrates a sample of Karma-Jasmine

After cloning, you need to navigate to the cloned directory and install project dependencies using the below command:

The example mentioned below would help you to perform Jasmine testing in Google Chrome.

Runn Jasmine Tests Using Karma

Navigate to the directory where you cloned the sample of Karma-Jasmine and run the following command.

or you could also run the test using:

Browser Launcher Configuration

If you look at karma.conf.js file you will find that we are passing browser, browser version, and operating system information, along with LambdaTest Selenium grid capabilities via capabilities object. The capabilities object in the above code is defined as:

The most important capabilities to understand here are ‘browserName’, ‘version’, and ‘platform’. They define which browser environment you wish to run the test on. Rest of the capabilities are important in test management and debugging. We have an inbuilt Capabilities Generator tool as well that you use to generate capabilities code for your test suite.

Testing Locally Hosted Projects using Jasmine Test Runner

To help you perform cross browser testing of your locally stored web pages, LambdaTest provides an SSH(Secure Shell) tunnel connection with the name Lambda Tunnel. With Lambda Tunnel, you can run your Jasmine tests using Karma to perform automated cross browser testing on browsers offered by online Selenium grid at LambdaTest. So you make sure how well your changes look, even before your customers. Curious to know more about Lambda Tunnel?

Follow our documentation on Lambda Tunnel to know it all. OS specific instructions to download and setup tunnel binary can be found at the following links.

Once, the tunnel is successfully set up. You can add the below code to your capabilities for testing internal servers on your network.

Important Note: Some Safari & IE browsers, doesn’t support automatic resolution of the URL string “localhost”. Therefore if you test on URLs like "http://localhost/" or "http://localhost:8080" etc, you would get an error in these browsers. A possible solution is to use "" or replace the string “localhost” with machine IP address. For example if you wanted to test "http://localhost/dashboard" or, and your machine IP is you can instead test on "" or "".

Avoid Timeouts With psuedoActivityInternal

To make sure our machines are not hold for long due to some incorrect test, we have come up with a restriction on the number of seconds that our machine is kept reserved for you. In cases, where our servers fail to retrieve a request from your local machine for more than 90 seconds, then your tests are aborted from the queue with the error message related to Timeouts.

If you wish to avoid such timeouts, you need to make use of the below parameter:

Note: psuedoActivityInternal is presented as a default parameter with a value set to 0. Make sure to provide a value more than 0 in order to avoid the timeouts.

Execute Jasmine testing using Karma & increase your test coverage using LambdaTest’s online Selenium Grid. Happy Testing!