Behat testing for an Insurance company

Behat testing for an Insurance company

Behat Testing for an Insurance Company
Submit guest post

The increasing need for incorporating inputs and feedback from business stakeholders into the website is making the enterprises shift to Behavior Driven Development (BDD) methodology. This ability of BDD to include feedbacks makes it easy for the end user to navigate through the website and use the existing functionalities.

A leading insurance company in Australia had a similar requirement, where they wanted the website to work seamlessly for external users. With ongoing feature additions and changes on the website, the insurance company contacted for automated QA testing to check all the lateral effects.

To ensure that both developers and testers remain in sync, Behat was chosen as the tool to make BDD possible. Behat was a good choice because it’s written in PHP, as is Drupal, which was used to build the website. used Behat for both functional testing, and regression testing.

Used Behat’s inbuilt (default) features

Srijan used Drupal extension with Behat to avail the default inbuilt features, for which we did not need to write any custom code. This made the tests easier and faster.

Integrated Selenium with Behat to enable cross-browser testing 

This was done to run the tests on multiple browsers simultaneously. This also helped in reducing the execution time of the entire suite. We can use Browserstack or Saucelabs for cross-browser testing

Performed end-to-end testing using Behat 

Srijan added custom code to get functionalities working. Suppose you want to click on a certain element on a web page, and for this Behat doesn’t give any default definition. Here, custom will add the corresponding PHP code for the definition. This is understood by Behat and mapped with the step in the feature file.

Integrated with Goutte driver to get Behat running headless 

When we run our Behat test with Selenium, the browser window opens up increasing the execution time. But when our test needs to be integrated with continuous integration, then longer execution time is not desirable, since we are only bothered with the execution report. So to decrease the execution time we used Goutte driver which runs headless in background. This is much faster and does not hamper anyone’s work.

Scenario based requirements

Srijan added tags to the feature file to get the entire suite to run using a single command and also to run some specific scenario based upon the requirement. Suppose there are 100 scenarios in one feature file and you only want to run 10 of them. You can do this by tagging the required scenario with any keyword using symbol @. 

Example : Let's say we use @regression. Now when you run your entire suite using a single command, and pass @regression argument in the command, then only the scenarios tagged with @regression would run.

Integrated Behat with drush and drupal API 

Drush enables us to use Drupal APIs. It was done to create different users, login and logout using authenticated user, anonymous users etc. without writing any custom code

Defined theme regions

This is used when a user is verifying the visibility/availability of certain elements in a particular region on the webpage, provided the same element occurs at multiple places in the webpage.

Behat integrated with CI (Continuous Integration) - Jenkins

This is helpful for integration testing when the development is done in chunks or small fragments.

Srijan’s QA Automation team enabled the client to check for the lateral effects on existing functionalities, whenever there are new changes on the website. It has helped the client reduce manual effort in testing and improve overall website performance. 


Write to us

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms Of Service apply. By submitting this form, you agree to our Privacy Policy.

See how our uniquely collaborative work style, can help you redesign your business.

Contact us