DEV Community

Discussion on: Test Driven Development in an Angular World

Collapse
 
siddrc profile image
Siddharth Roychoudhury

You have not spoken about e2e, which actually is the place where TDD originates from in-case of front-end, where e2e tests the entire page , where page is filled with components.
So we start by writing the spec for the entire page, and then slice out the spec into much smaller pieces and draw out the unit tests/spec for each component.
After writing one e2e spec, we see it fail, then move on to individual component unit tests one by one in the same flow as you mentioned.Once the unit tests pass, we then check e2e is passing or not. Unit tests check the component in isolation, e2e check entire pages or user flows from page to page and test entire frontend application.May be I will add a link here for E2E Testing in Angular using TDD approach.

Collapse
 
cthulhu profile image
Catalin Ciubotaru

The concept is the same. It applies to unit tests, e2e tests etc.
This was mainly to show a simple approach to TDD and to demystify the difficulty of it.

Collapse
 
muhammedmoussa profile image
Moussa

I think e2e doesn't mean exactly fronted only, this case suits should cover case from the user interaction in the UI to server request till server response also.
Another point discussed tests can be considered as an integration test not only unit test which is one of its goals handle integration between components logic and template.