0.5 by Sebastian Bergmann.
......
Time: 00:00
OK (6 tests)
Our DB code is looking hard to break.
In real life unit testing, you need to think beyond how you can break your own code.
If you can write unit tests that break your existing code, that's better.
Reflection and Unit Testing
[ 124 ]
Test Driven Development
Now it's time to go further into unit testing. You may ask when you need to write
unit tests before coding for applications: during time of development, or after
finishing coding? Well, developers from different corners have different things to
say, however it is found to be more useful to write the test first and then go for a real
application. This is called Test Driven Development or TDD in short. TDD helps
you to design better API for your application.
You may ask how to write tests when you don't have any real code, and which
things to test? You don't need real objects for TDD. Just imagine some mock
objects, which have just the functions. You will use those functions with the
imaginary result. You can also write incomplete tests, which means a test with blank
body. At your own convenience, you can write you can write the content of the test.
Pages:
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139