# unit testing and e2e testing with cesium

**URL:** <https://community.cesium.com/t/unit-testing-and-e2e-testing-with-cesium/1477>\
**Category:** CesiumJS\
**Created:** [September 9, 2014, 9:24am UTC](https://community.cesium.com/t/unit-testing-and-e2e-testing-with-cesium/1477 "2014-09-09T09:24:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![netanelgilad](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@netanelgilad](https://community.cesium.com/u/netanelgilad)\
**Post date:** [September 9, 2014, 9:24am UTC](https://community.cesium.com/t/unit-testing-and-e2e-testing-with-cesium/1477/1 "2014-09-09T09:24:22Z")

</div>

Hey guys,  
Thanks for your awesome tool! We love it here.  
We are currently looking for a way to write unit tests for our code the uses cesium. We are writing mock objects for cesium so that we can test our code without actually initializing a cesium widget. This amounts to a rising number of mock objects for different things in cesium (collections, layers, scene and such..).  
Is there a best practice for unit testing code that uses Cesium? Is there a framework for that?  
And the second question is if there is any framework for e2e testing with Cesium which is a bit different from unit testing cause there we really want to init the cesium Widget and check that the stuff we want happend.

Thanks in advance,  
Netanel.

---

<div class="post-metadata">

**Author:** ![patrick](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/patrick/32/2045_2.png) [@patrick](https://community.cesium.com/u/patrick)\
**Post date:** [September 12, 2014, 3:00pm UTC](https://community.cesium.com/t/unit-testing-and-e2e-testing-with-cesium/1477/2 "2014-09-12T15:00:09Z")

</div>

Hi Netanel,

Why do you want to avoid initializing Cesium? Do you have a lot of fine-grained tests and you want them to run quickly?

In the Cesium [unit tests](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Specs), we do mock out a number of Cesium classes, but it is done on a case-by-case basis. We also have tests that only create a Scene, for example, instead of a Viewer widget ([example](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/Scene/ModelSpec.js)).

Let us know if you write a Cesium testing library; we’re happy to list it as a [Cesium plugin](http://cesiumjs.org/plugins/).

Patrick
