Tag Archives: end to end test

Link

Run Karma test suite in Intellij

You will need to install the Karma plugin into your intellij to get this to work.

I have not found out how to run individual tests with Karma.

Advertisements

Javascript page object pattern based functional tests via the browser with Protractor and Astrolabe

Update: 26/04/14 – added example github project showing an example project with config setup and simple test.

Example project on github: https://github.com/onekilo79/protractor-astrolabe-example

Purpose

Page Object Pattern

When writing browser based tests with selenium the test can become brittle if they are too attached to the xpath of the css selector when the page look and feel changes.  To limit your exposure to changes in the styling of the page you can use the Page Object Pattern.

Library that does Page Object Pattern in Groovy

In Groovy we have the excellent Geb by Luke Daily.

Continue reading

Configure Grunt-protractor-runner to run with a global install of protractor

Purpose

The reason to install protractor globally is that if you use the inline protractor provided with grunt-protractor-runner you have a 10 second penalty of waiting for the server to spawn a java process and then attach itself to it.

With the server already started and waiting for calls it is a lot faster turnaround for your tests to run.

Install protractor

Install protractor globally

If you have installed protractor globally to do your end to end testing via:

You may have to do this as sudo if you

npm -g install protractor

Download the chromedriver by updating webdriver-manager

webdriver-manager update

Continue reading

angularjs e2e test with $http and out of memory exception

My experience with $httpBackend with e2e tests and out of memory exceptions.

$httpBackend and out of memory exceptions

I am running yadda with casperjs to do functional end to end testing.

I was doing a simple $http request that would expect some JSON back.  I was getting through 2.5gb of ram before my Casperjs test would fall over with out of memory exception and Phantomjs telling me how to report this bug.  I followed the instructions to get an error report for Phantomjs and it was not giving me any useful information for a bug report, so it was something in my code that was the problem.

What I figured out:

Returning invalid JSON and making lots calls to the $httpBackend in quick succession then I experienced my tests falling over very quickly with out of memory exceptions.  It also slows down the tests as the memory does not get released very quickly.

If you make lots of calls to $httpBackend full stop then it tends to chew through lots of memory.  Use it sparingly and have your code against calling it too frequently as it is very expensive.

There is caching available for on $http requests but I have not used it yet. $http