WebdriverIO Jasmine Framework

02 Mar 2023  Amiya pattanaik  2 mins read.

A Next-gen browser and mobile automation test framework using WebdriverIO with Jasmine. Write your super fast BDD tests using webdriverIO with jasmime and it is particularly useful for testing web applications and native mobile applications for iOS-enabled devices.

Use Case

An automation team in a project is using the WebDriverIO framework and its plugins to design powerful and robust automation tests and perform end-to-end testing of the web application. The client has requested the project team to test the application from the user’s perspective by implementing BDD which aims to help both developers and quality engineers build software that is predictable, reusable, resilient to changes, and not error-prone.

The team has decided to use Jasmine as it supports both BDD and TDD framework and write acceptance test scenarios in the same tool used by developer for unit testing and same tool used by quality engineers. These scenarios must be mapped to the automation test code.

The project team must look forward to designing a framework that can integrate both BDD and TDD scenarios with the WebDriverIO test automation code, execute on multiple browsers, and generate interactive test reports like Allure, JSON, HTML etc.

Jasmine provides a way to write a structured code for testing the applications thoroughly, classifying them into test suites and test cases. Mapping errors to corresponding test cases allows us to produce a test report after the run.

Supports both synchronous and asynchronous testing: Jasmine is designed to fortify asynchronous testing with features that invoke the callback once the test is finished. It enables synchronous testing by omitting the callback.

Jasmine framework does not require a DOM and is very easy to set up. Also, it provides an immaculate and easy to read syntax like below example-

describe("A suite is just collection of testcases", function() {
  var a;

  it("is just a testcase ", function() {
    a = true;
    expect(a).toBe(true);
  });
});

webdriverIO-with-jasmineBDD will enable the team to achieve automated testing of the application from the user’s perspective.

  • Framework: WDIO-V8 with Jasmine (V4x).
  • Features:
    • Page Objects Model uses with ES6 /ES7 style class base approach and TypeScript support
    • Examples with demo app https://search.yahoo.com and http://the-internet.herokuapp.com
    • Examples of multi browser and headless browser execution using - Chrome and Firefox
    • Cloud testing Integration with BrowserStack, Sauce Labs, LambdaTest
    • Multiple reporting (Spec, Xunit/Junit, Allure, JSON) and Hosting Allure and Xunit/Junit reporting on WebServer.
    • Examples of read/write data from MS-Excel for easy test data management from external data sources with examples
    • Examples of DB connect to any RDBMS (Oracle, MySql, TeraData, Vertica etc.), any query execution / fetching result set etc. with examples for E2E testing
    • BrowserStack, Sauce Labs, LambdTest and Appium specific .config file ( for playback on mobile device.) For one click Appium setup on local machine for iOS and Android refer to [appium-setup-made-easy-OSX](https://github.com/amiya-pattnaik/appium-setup-made-easy-OSX){:target="_blank"}

We encourage our readers to treat each other respectfully and constructively. Thank you for taking the time to read this blog post to the end. We look forward to your contributions. Let’s make something great together! What do you think? Please vote and post your comments.

Amiya Pattanaik
Amiya Pattanaik

Amiya is a Product Engineering Director focus on Product Development, Quality Engineering & User Experience. He writes his experiences here.