DEV Community

Discussion on: BDD rather than TDD: Result-Oriented Testing

Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

Thanks for sharing your take with BDD!

I totally agree with you about not relying on low-level or higher-level unit tests... what matters is that the tests check X feature is actually working.

Actually, I do some cheating in some parts that my BDD tests sometimes look like:

  1. Typical unit test, like checking the (200 OK, 403 Forbidden) responses from my endpoints as in here: github.com/coretabs/dorm-portal/bl...

  2. Low-level unit test. Since, sometimes I have to check how the function behaves under different scenarios.
    E.g: checking create_review function and checking the date (and freezing at a specific point of time):
    github.com/coretabs/dorm-portal/bl...

  3. Integrated test. Like what I did when I tested uploading photos via API:

github.com/coretabs/dorm-portal/bl...

I used a real photo file cuz I have to check if hitting that endpoint is gonna ACTUALLY upload it in my media folder.