loading...

Can't find good TDD courses for Node

ankush981 profile image Ankush Thakur ・1 min read

I come from a PHP background (with some decent JS skills) and want to learn Test-Driven Development. Now, I've also been meaning to program in Node, and thought that it'd be a good idea to find a course/book that covers both Node and TDD. Except that I can't find any. An believe me I've looked around a lot.

Sure, there are web pages and Udemy courses, but they cover only the mechanics of unit testing, not the art of it. As such, I feel that those are useless. I mean, I found Udemy courses on Node TDD that span 2 hours. 2 hours?!

I do have come across such creations in other programming worlds:

  • PHP has Adam Wathan's https://course.testdrivenlaravel.com/ (sure, it's Laravel, but I don't mind learning a new framework if the TDD is taught well enough)
  • Python has https://www.obeythetestinggoat.com/ (uses Django 1.11, but I'm happy to learn that as well)
  • Ruby on Rails (way too many books, guides and courses to pick one)
  • Java (again, way too much material available to even mention)
  • Node: 🤔🤔🤔

This surprises me because Node has been around for long enough to have such critical educational pieces missing. I, for instance, won't be surprised if I don't find such material in Go, Rust, etc.

Anyway, back to my point: Do you know of such a resource in the Node community (server-side only, please)?

Posted on by:

ankush981 profile

Ankush Thakur

@ankush981

Fullstack dev working in Laravel, Node, Vue and React. Looking for bigger challenges!

Discussion

markdown guide
 

I don't know about any particular Books or courses, I did some research a while back, and most stuff I found where articles and forum posts explaining a bit how it works (not very detailed). I've never found a really advanced or in depth course!

Maybe you have already done it, but I would suggest looking at the docs from the testing frameworks, in case they have some documentation on best practices, or some useful info.

I saved this one article that has some insight into testing more advanced features (server-side nodejs): blog.risingstack.com/getting-node-...

 

Testing framework docs suffer from the same problem: they teach you how that framework helps you test; they don't tell you how to test, or what the art of testing is! It's the same with all these Udemy courses: 24 hours of simple, straightforward projects, but the real challenge when you're in a job, there's time pressure, and there are requirement changes that undo everything -- nobody teaches that.

 

Yup, I totally agree.

I would think it's up to the each company to decide how to do TDD in their projects.

Although I understand your point, I don't think there is such thing as TDD art or a correct way of doing it, I think just doing it will improve your projects, the art is more so to create code that is testable rather than fixating on the tests themselves.

I also liked the sentence that Markus posted earlier:

TDD is like going to the gym. Constantly usage is more important than doing it sometimes with high devotion 😊

If I find any relevant info about this I will let you know, or I may ask my boss, what his opinion is about this.

the art is more so to create code that is testable rather than fixating on the tests themselves.

Yup, I didn't mean that there should be a myopic focus on tests only. How to structure your code, how to mock, etc., what not to test (and other things I can't list because I don't know testing :P) -- practically nobody teaches these important things. :(

I may ask my boss, what his opinion is about this.

Please do!

Ohh I see, yup that stuff is often ignored when explaining TDD.

I will try gathering some resources I used a while back when I learned it myself... Although it's not guided I think it will be a good starting point for you.

What level of knowledge do you have in testing in general? (just to know what would be helpful for you)

 

I have also just seen this book, I don't know if it is what you are looking for or have seen it already, worth a check: tddjs.com/

PD: It is not cheep though!

 

$48 for a PDF, yikes! But worth bookmarking and perhaps buying later. Thanks a lot for mentioning this. :)

Yup, it's not cheap at all, but work saving :P

 

Well, isn't TDD language independent?
You start by writing the tests (for example by using jest as test framework) and implement your functions to pass those.

To be honest, I thought that's it 😅
Doenst matter whether you're using go, Java, JavaScript or rust - you just need a framework/tooling like jest, JUnit or what fits your needs

 

Well, isn't TDD language independent?

Yes, it is. So are loops, objects, database access, and a thousand other things. But you need to decide on a single language to start learning any of these.

The point is that if you're a JS dev, it's not practical to start learning the Java and Spring ecosystem, for example, for understanding design patterns.

You start by writing the tests (for example by using jest as test framework) and implement your functions to pass those.

It's easy to say this for someone who already knows unit testing (it's like those senior devs balking at Laravel and Django who proclaim that frameworks are useless and everyone should roll their own -- the reality is that everyone is at a different level and use case). But for someone who wants to really learn the process, the craft of TDD, having a resource in their own language (and preferably, framework) is very important.

 

Unit testing was part of my computer science class - so about 30 min theoretical information about what it is and about 30 min practical training (in Java).

Starting with node (I never used Java outside the university) I just had a look at jest.

With my first comment I wanted to say that TDD (in my opinion) is not a craftsmanship you've to learn extensively. Going with the 2h udemy course would be way more than I've ever done.

TDD is like going to the gym. Constantly usage is more important than doing it sometimes with high devotion 😊

 

I'd recommend looking into Jest since it provides the most seamless testing setup imaginable for JS/TS development. Here's a decent tutorial on TDD with Jest:
freecodecamp.org/news/a-quick-intr...