Answer the question
In order to leave comments, you need to log in
What is the correct approach to writing tests?
Good afternoon, Toaster Dwellers
I have been learning to write unit tests for a year now, but there are still questions about correctness.
Example:
There is an API written in Scala PlayFramework 2.2.1. I write tests on Specs2. To call the API, you need an access token in the headers, which in my case is dev-token . Moreover, the method I'm testing requires the result of other methods.
Problem: I read that tests should not depend on external conditions.
Question: Do I need to recreate the dev-token and also call other APIs in the SetUp method, and then clean up the results in the TearDown method? Or should my test always rely on the dev-token to exist and other methods to be called?
How to write tests correctly? Is there a 50 page manual with examples? I really want to be a TDD guy.
Thanks
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question