AnsweredAssumed Answered

Test Driven GIS Development

Question asked by ccoleman on Nov 16, 2017
Latest reply on Nov 22, 2017 by ccoleman

Does anyone out there have any good examples, tips and tricks for practising Acceptance Test Driven Development (ATDD/BDD) and Test Driven Development (TDD) with GIS in a Continuous Integration (CI) environment?

 

In the most part when I develop software, I write Acceptance Tests first using Gherkin and Cucumber to execute them.  I then make the code in whatever language is appropriate (usually Python) and use unit tests to ensure the code is working.

The problem in a GIS environment is creating test cases that can be arranged, actioned and asserted quickly in order to reap the benefits of fast feedback in an Agile team environment.  Much of the Continuous Integration documentation and online material suggest that the total execution time from check in of code to VCS to detecting a broken build (either failed compilation or failed tests) is around 10-15 minutes.

 

With ArcGIS and GIS in general, I find it can take an age to even do the most basic tests - just loading arcpy in a python script can take upto 20 seconds which seriously puts constraints on your fast feedback loops.  To overcome this in most programming environments, one could create a mock that would substitute the behaviour however I'm finding this difficult to achieve for all but the simplest scenarios or those that interact with ArcGIS Server's REST API (because you can mock service end point easily).

 

If tests take too long to execute, developers put off the testing and check in of their code to VCS and CI, which delays integration, reduces transparency, wastes time, reduces quality and potentially increases time to market (TTM).

Outcomes