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?
What's the advantage of using Sinon.js over Jasmine's built in Spys?
Asked Answered
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. –
Multiflorous
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. –
Belen
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. –
Mountaintop
* Posting it as an answer, since this didn't fit in the Comments section! *
FWIW, We used SinonJS to create a FakeHTTP(LinearEPG)server component 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!
© 2022 - 2024 — McMap. All rights reserved.