Search code examples
angularjstestingionic-frameworkend-to-end

How to begin writing code for e2e testing in ionic ?


I am new to ionic and decided that i wanted to integrate testing while building my app. But I am a little confused.

Should i write a test after already written functions? or functions that I will write?

Should I test every function ?

I would appreciate if someone just explains the logic flow for me.


Solution

  • Well, you could look into TDD (Test Driven Development) and that should answer your questions.

    However, to provide a short answer here as well; you should write a test first, code later (for the why consult the link above). In practice, testing every function may not be viable, but TDD certainly enforces it.

    One thing to note, you wrote E2E, but actually what you'll be doing at the start is Unit Testing your functions (E2E comes later).