Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BDD and TDD for node.js?

What is used for BDD and TDD with node.js?

I'm used to use Cucumber + RSpec. What's a good combo for node.js?

thanks

like image 246
donald Avatar asked Jan 16 '11 14:01

donald


People also ask

What is TDD in node JS?

Test-Driven development approach using Node JS. These steps below tell you how the JavaScript TDD approach can help you write failing tests and codes to satisfy the tests and a refractor in Node JS. The steps also help writing a new module as well as creating testing tools and principles!

Can we use TDD and BDD together?

Short answer, yes.

What is TDD and BDD with example?

TDD is a development practice while BDD is a team methodology. In TDD, the developers write the tests while in BDD the automated specifications are created by users or testers (with developers wiring them to the code under test.) For small, co-located, developer-centric teams, TDD and BDD are effectively the same.

Which testing framework is best for Node JS?

What are the best Node. js unit testing frameworks? According to “The State of JavaScript 2021,” the most popular JavaScript testing frameworks and libraries in 2021 were Testing Library, Vitest, Jest, Cypress, Playwright, and Storybook. Rounding out the top ten are Puppeteer, Mocha, Jasmine, AVA, and WebdriverIO.


3 Answers

Update

Mocha gets my vote now!


You could have a look at the testing modules section from the node.js modules page. For example Vows is a pretty popular BDD framework.

Vows is a behavior driven development framework for Node.js.

like image 165
Alfred Avatar answered Sep 20 '22 14:09

Alfred


Check out mocha - (github)

Also mocha-cakes, my attempt for Cucumber syntax on mocha.

like image 31
Quang Van Avatar answered Sep 22 '22 14:09

Quang Van


If you are used to rspec, Jasmine is pretty nice. I've not used it on Node.js, but I have used it for testing a backbone app. It's syntax is very similar to rspec. Taken from the site above:

describe("Jasmine", function() {
  it("makes testing JavaScript awesome!", function() {
    expect(yourCode).toBeLotsBetter();
  });
});

It's listed in the link provided by Alfred above, but since folks listed Vows as an example, I figured I'd give Jasmine a bump, especially since it's syntactically similar to rspec ;)

like image 33
Craig Monson Avatar answered Sep 18 '22 14:09

Craig Monson