Servoy Mobile Unit testing

Starting with Servoy 7.2 (in developer) and Servoy 7.3 (for automated testing) you have the ability to run jsunit tests for mobile solutions. The test will run browser-side in an mobile "test" client (which is actually a normal mobile client with small changes to allow unit tests - for automatic authentication, test-suite reporting, ...).

Mobile jsunit tests can be run - similar to Smart Client jsunit tests - both from Servoy Developer (using a browser installed in your OS) or as automated tests that can run as part of an automated build system (Jenkins, Cruise-Control, ...).

Creating a test solution

In order to write tests for your mobile solution - let's name it "x" - you can create a new solution "test_x" solution that has "x" as a module.

Then you write the unit tests in the usual way. Methods prefixed with "test" in global/form scopes will be considered to be test-cases and will run wrapped between "setUp" and "tearDown" methods of the same scope. Use "jsunit.assert..." methods to check that everything happens as expected.

Create a "test_x_service" solution that will feed data and table information as needed to your mobile client test solution - just like you would do with a normal mobile test solution.

A very basic sample mobile test solution setup is available for download at building a software factory tutorial.

Running tests in Servoy Developer

In order to run mobile jsunit tests in Servoy Developer you can use:

For those interested in what's going on behind the scenes during a test-run:

Creating automated Servoy Mobile Unit Tests

You can automate this testing process by using the command-line/ant mobile .war workspace exporter,  the .servoy solution workspace exporter and the mobile import test client as detailed here.

These, in conjunction with a Selenium based (local or cloud) setup allow you to run tests automated in all popular browsers/platforms/devices. For example a nice integration can be achieved with Servoy - Jenkins (build automation software) - Sauce Labs (cloud based selenium test automation provider).