I'm piecing together a jsTestDriver/Jasmine environment for testing our front end code and I'm seeing a lot of references to Sinon.js for stand-alone (or drop in) spies. Could someone describe what Sinon.js brings to the table that Jasmine doesn't for testing the UI?
I'm piecing together a jsTestDriver/Jasmine environment for testing our front end code and I'm seeing a lot of references to Sinon.js for stand-alone (or drop in) spies. Could someone describe what Sinon.js brings to the table that Jasmine doesn't for testing the UI?
Share Improve this question asked Aug 31, 2012 at 13:11 jpgracejpgrace 4014 silver badges9 bronze badges 3- 4 I don't see why this should be closed as non-constructive. I've been using jasmine heavily for more than a year and still wonder why people add sinon.js. Inclined to say there is nothing sinon adds that does not already exist but would love to hear from a sinon.js user. – ggozad Commented Sep 2, 2012 at 15:56
- The problem with the question is, that there will be no specific answer. You may think there is no need for sinon.js other may think its the best thing since sliced bread. One may thing a feature is an advantage other may think its over engineered. So what will be the right answer to this question. – Andreas Köberle Commented Sep 2, 2012 at 19:40
- 4 The correct answer to the question would be the differences in philosophy and/or implementation with emphasis on how this impacts UI testing. Some room for subjectivity, but not much. – Dave Snigier Commented Sep 6, 2012 at 4:00
1 Answer
Reset to default 5* Posting it as an answer, since this didn't fit in the Comments section! *
FWIW, We used SinonJS to create a FakeHTTP(LinearEPG)server ponent for implementing the REST-APIs of the real-server that hosts the EPG(Linear TV Program Schedule) info.
Then, we used this FakeHTTP-LinearEPG server in two modalities:
- Used with the Web-App displaying EPG for testing the navigation etc.
- Test the Javascript-code that fetches the EPG along with Jasmine UT Specs.
Granted, we could have implemented the FakeServer functionality using Jasmine-Spies, but it seemed to be bit convoluted. On the other hand, the FakeServer provided an elegant and quick way to emulate the Server providing the REST-interfaces.
SinonJS-based FakeServer proved to be quite useful when the server itself was still under development at that time!