I have done some TDD, but I am not satisfied with the experience so here are some questions and confusion I have before starting the course:
- TDD and state based testing using stubs -
How can I write the test first if I don't know something about the data being worked on?
So you should prototype before writing tests?
But what about TDD then?
Wouldn't it be better to model up some domain first?
Then you might get better off writing an acceptance test first, using an example provided by some business specialist?
- Why do I ever need Mocks? -
I can write acceptance tests or integration tests instead?
Can interaction testing be replaced by code contracts in C# 4? - There is a new concept "Code Contracts" which let you apply pre conditions, post conditions, assertions and invariants. This lets you express requirements and promises between APIs. The contracts can be used to check your code for correctness at compile time.
- Why would I use mocks to verify multiple method calls?
....if I do not know what data and objects these method calls would return?
- Arrange, Act Assert is the same pattern used in acceptance tests? E.g. -
Given, When, Then
As a "user", I want "something", so that "benefit"
- Regarding bugs: Write a test that fails, then change the code to get the test to pass? -
Hard to do in a legacy world?
- Refactor before introducing tests in legacy code systems?
- How to handle large amount of test data?
- How to handle tests and changing requirements?
Especially during project start up when requirements are not "set"?
- Using IOC to get stubs?
I hope Roy can clarify and guide me into being a better developer!
Ingen kommentarer:
Legg inn en kommentar