DEV Community

Discussion on: My first ever unit test

Collapse
 
recursivefaults profile image
Ryan Latta

Hooray for testing!

As time goes on you'll begin to uncover that writing tests is a whole different skillset. Enjoy getting better at it!

As you continue to test, here are a few experiments to consider:

1) Mocking - Used to isolate pieces of code from one another. How would you write this test without mocking? What would the smallest, "Unit" of code that you can test be? What might that tell you about your coupling?

2) Write your test first. Write a test that expresses the wish of your code. Watch it fail, then work to get it to pass. How does your test/implementation code look compared to the other way?

Collapse
 
bassemibrahim profile image
Bassem

yeah, I read about the test-driven approach, Sounds cool. But I don't feel that many people are using it