Tag Info

Hot answers tagged

16

In order to write the test in the first place, you have to design the API that you are then going to implement. You've already started on the wrong foot by writing your test to create the entire GameOfLife object and using that to implement your test. From Practical Unit Testing with JUnit and Mockito: At first you might feel awkward for writing ...


9

This felt odd as I was forcing the design of the implementation based on how I had decided at this early stage to write this first test. I think this is the key point in your question, Whether or not this is desirable depends on whether you lean towards codeninja's idea that you should design up-front then use TDD to fill in the implementation, or ...


5

There are many cases where you write a test that is not simply the answer to a question. Compare 'does the controller send a notification mail' with 'controller should send notification mail'. Both are valid, but it is much easier to read a list of tests formulated as 'should' rather than formulated as questions. Another major point in TDD is that the test ...


3

You cannot jump directly from "idea" to "implementation". Good example is the "V model" : You start at high level go lower and you write tests on each level. And each level gets more specific in both implementation and testing. For example you write an acceptance test that says that you should be able to add a customer. This results in you writing an ...


3

BDD style tests (as might be the case with the framework you're using) follow the Given-When-Then convention, not Question-Answer. Depending on the approach prescribed by your testing library, shoehorning questions in there might feel awkward. However, questions could fit well in more classical test schemes where the test description is entirely contained ...


3

Ideally, you want both unit tests (which test individual functions) and integration tests (which test all the functions together), not just one or the other. You will also need a way to mock out the web service you're calling so that these tests don't depend on it. To directly address a few of the sub-questions: So is correct to create a big test that ...


1

Two things could help you there: Instead of Use Cases, User Stories. Why? Well User Stories are written for/by the user. They are not an accurate description of functionality, but do specify what the user wants to do. This can be your initial road map into writing code that actually allows the user to do something, rather than comply with system ...


1

Given a scenario, when some method is called the data must be persisted into db and have following steps: Setup empty db simulator (you call it mock) and pass it in as a dependency do call the method you are testing Verify the data was stored in simulator OR Setup db simulator with predefined data and pass it in as a dependency do call the method ...



Only top voted, non community-wiki answers of a minimum length are eligible