GIS unit testing frameworks

2260
5
11-06-2013 11:40 AM
GaneshSolai_Sambandam
New Contributor III
Hi guys
I wanted to know what type  of testing  frameworks, do you use when developing application using arcgis javascript api. At the moment, I am confident of creating any web gis application and adding lot of gis functionality and geoprocessing functions in my application by looking at the sample codes from the arcgis.com. And, I don't use any testing framework in my application.
At the moment, I only test my code by running my application on the local server and test under different browser environments (chrome, firefox and IE) to see if the code works or not. If I got an error, I mostly look at console window or use try and catch error methods to find the problem.

As a GIs developer, do we need to have knowledge on testing frameworks like ( jsunit, nunit). Just wanted to know, without this unit testing framework knowledge, would a GIS developer able to survive in Real  time application development. Is this pre-requisite for a GIS developer to become a competent software developer.

Finally, if I have been offered an GIS developer job and if they wanted me to write unit test my code, and if I say i don't know, will I be thrown out of the job.


If anyone can throw some lights on this, will be much appreciated.
0 Kudos
5 Replies
JeffJacobson
Occasional Contributor III
I have personally used QUnit.

It looks like Esri is using Karma in some of their GitHub projects.
0 Kudos
ReneRubalcava
Frequent Contributor
Esri-leaflet is using karma with mocha for testing to conform to Leaflet practices.
https://github.com/Esri/esri-leaflet

Here is a project using karma with ArcGIS JS API.
https://github.com/DavidSpriggs/esri-karma-tutorial

Jasmine is pretty popular too, but until recently development was a bit stagnant.
http://blog.davebouwman.com/2013/07/26/automated-headless-unit-tests-with-esri-js-api/

I prefer to use mocha under Grunt as I prefer how mocha handles asynchronous testing.
http://visionmedia.github.io/mocha/

I would also take a look at the agrc/StubModule project that can help you stub ArcGIS JS API modules for testing.
https://github.com/agrc/StubModule

Most developers don't write enough tests, I know I don't write as much as I should, but a good set of tests pays for itself in the long run. Also, tests are documentation. If I ever need a better understanding of a library or project, I can usually clear it up by looking over the tests. So that's one thing to keep in mind, if I hand this project off to someone else, will my tests guide another developer to better understand what it is doing?
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Hi Odoe,
Thank you very much for the valuable feedbacks. But, Just wanted to know, we only need to carry out unit testing when we are trying to build new GIS classess or creating new modules with new GIS functionality and trying to integrate them with our application. Am I correct?

If you are not building new classes, but your are just using the existing ArcGIS javascript API classes and trying to use those classes to create webgis application, in that case, do we need to carry out unit testing? I don't think so? any suggestion please?

In your last comment, you also mentioned that most developer don't do unit testing - if i understood your statement right, unit testing is only needed when you are creating your new GIS classes that are not already present within ARCGIS javascript api.

Can you please give some suggestion please?



regards
Ganesh
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Can any one tell me when to write unit test cases and what are situations you should write unit testing?

Assume, If I am going to work as a GIS developer, I am trying to look at the sample codes at the ARCGIS javascript samples and tyring to integrate those functionality in my application, in those case, Do I need to write unit testing to test my application?

I am really confused here.

Anyone, working in big GIS software development team or experienced GIS developer working in this area, please throw some lights on it.
0 Kudos
GaneshSolai_Sambandam
New Contributor III
Hi GIS  folks,
Please help to give some on idea on the threads below.
0 Kudos