Savings API testing spike
Background
Mifos currently has a long build time due to having a large number of user interface (browser) based acceptance tests. This either slows down development or threatens reliability as developers may sometimes perform only partial builds.Â
The second issue is that acceptance test writing has typically been very slow and thus a large backlog of manual acceptance tests.Â
Goal
To reduce the number of selenium tests by writing such acceptance tests at the API level.
To write acceptance tests at a much faster rate than possible in selenium.
Results/Observation
No page navigation code - When writing acceptance tests using Selenium, navigation code can be significant. Obviously this is not the case in API tests and makes tests terse and easier to understand.Â
No asynchronous operations - In Selenium tests, determining the completion of an operation may be indeterminate. The solution used often is to wait until an event such as a page load occurs. This is sometimes brittle and has been a source of intermittent build failures. Tests written at the API level are synchronous and therefore do not suffer such issues.
Time consuming database entity lookups - In writing API level tests, datasets are still used to get to a known state savings several lines of code. There is a minor drawback with using the datasets however - i.e. having to browse the database to lookup entity ids and such. A straightforward solution to this would be to write a 'cheatsheet' for each dataset perhaps in the Wiki for quick reference.Â
Example
Take a look at SavingsTest.java in hudsonBuildMifos-4174