This is part of my automated build series. The aim is to automate a lot of the Cordova Background Service plugin process.
I'll need some custom tools and processes to test the library. In this post I'll blog the reason why and the tools to use.
To facilitate this I have created two components:
All of this is available in this repository: https://github.com/Red-Folder/Jasmine-REST-Reporter
At the time of writing all of the URL details are hard coded. I've provided notes below on what to watch for.
Words of wisdom: Because this uses hardcoded details - be mindful of IP/ computer name changes. I spend an hour debugging this only to finally realise that my laptop had picked up a new DHCP address.
Windows Application Console receiver - made up of:
The jasminerestreporter.js is used within your Jasmine tests. Using the example project from Jasmine site (https://github.com/pivotal/jasmine/downloads);
var restReporter = new jasmine.RESTReporter(); jasmineEnv.addReporter(restReporter);
NOTE: jasminerestreporter.js is hard coded to a specific URL. This will need to amended for your environment.
The receiver provides the REST service that the reporter communicates it's results to.
It's a fairly basic application - it will print to the console the details it receives from the reporter. It will also exit with an error code if any of the tests fail, none of the tests run or after a timeout period (5 minutes).
You can build the receiver using Visual Studio 2012 Express for Windows Desktop (or greater).
Use Nuget to add the following packages:
This should give you a Console Application ready to use
NOTE: The Receiver is hard coded to a specific URL (see program.cs). This will need to be amended for your environment.
Windows needs to be told that the Console Application is allowed to listen on the given port. To do this run the following command:
netsh http add urlacl url=http://+:8181/ user=machine\username
where machine\username is your user account.
NOTE: If you change the port that you run the Console Application on, then this will need to be reflected in the above command.
The above is all prep for the next Part of this series - that article will go through how to use the above in a practical situation.