Need advice about which tool to choose?Ask the StackShare community!
Jasmine vs SuperTest: What are the differences?
Syntax: Jasmine uses a behavior-driven development (BDD) syntax that focuses on writing human-readable test specifications using keywords like
describe
,it
, andexpect
. On the other hand, SuperTest uses a more traditional syntax that follows the express.js framework, where requests are sent using theget
,post
,put
, etc. methods.Testing Scope: Jasmine is primarily designed for unit testing and is suitable for testing individual functions, classes, or modules within an application. SuperTest, on the other hand, is designed for integration testing and is used to test the entire end-to-end functionality of an application, including the HTTP routes and endpoints.
Framework Compatibility: Jasmine is a testing framework that can be used with various JavaScript frameworks like Angular, React, and Node.js, whereas SuperTest is a testing library specifically designed for Node.js and Express applications, making it the preferred choice for testing HTTP servers built with Express.
Testing Approach: Jasmine follows a traditional testing approach where tests are written as separate files and executed using a test runner. SuperTest, on the other hand, integrates testing within the application code itself by using middleware, allowing the tests to be seamlessly executed alongside the application.
Assertions and Expectations: Jasmine provides a comprehensive set of assertion functions and matchers that enable developers to check the expected behavior of their code. SuperTest, on the other hand, relies on the
expect
library for assertions, which provides a more minimalist set of assertion methods.HTTP Requests: SuperTest is specifically designed for testing HTTP requests and provides built-in methods like
get
,post
,put
, etc., which allow developers to easily simulate and test different types of HTTP requests. Jasmine does not have built-in support for making HTTP requests and requires additional libraries or frameworks to handle the HTTP requests.
In Summary, Jasmine is a behavior-driven testing framework primarily used for unit testing, while SuperTest is a library designed for integration testing of Node.js and Express applications, specifically focusing on testing HTTP endpoints.
We use Mocha for our FDA verification testing. It's integrated into Meteor, our upstream web application framework. We like how battle tested it is, its' syntax, its' options of reporters, and countless other features. Most everybody can agree on mocha, and that gets us half-way through our FDA verification and validation (V&V) testing strategy.
Pros of Jasmine
- Can also be used for tdd64
- Open source49
- Originally from RSpec18
- Great community15
- No dependencies, not even DOM14
- Easy to setup10
- Simple8
- Created by Pivotal-Labs3
- Works with KarmaJs2
- Jasmine is faster than selenium in angular application1
- SpyOn to fake calls1
- Async and promises are easy calls with "done"1
Pros of SuperTest
Sign up to add or upvote prosMake informed product decisions
Cons of Jasmine
- Unfriendly error logs2