How write tests. Can you look at my first testCase?
- fmasa
- Member | 2
What exactely is the point of the test.
First test (testBaseDependencies) is IMO pointless, because all you're testing is DI autowiring.
The other tests seem to be some kind of integration test. There are several improvements that can/should be made.
First of all:
test (case) should contain three phases:
1. “Given”:
Prepare/mock/stub dependencies and create tested object. INSERT necessary data
into database, prepare filesystem or whatever your dependencies are.
2. “When”
Perform tested action (invoke presenter action in your case). That's the easy
one :)
3. “Then”
Check whether result matches your expectations.
Where are the articles created? I don't see it anywhere in that test case or bootstrap. Does your test depend on live database? What if you want to run two tests – “show” action and “delete” action?
- Čamo
- Member | 798
fmasa
Yes, I do it on live database. I don't know how and on what level to create
parallel database. Also what is necessary to set up if I want to run parallel
DB. Thats the reason why there are no delete/create test. I am little confused
about how it works.
If you have some useful links past it here please.
I found these
http://blog.janmarek.net/…m-presenteru
http://zlml.cz/…teru-v-nette
http://zlml.cz/…plne-kazdeho
Last edited by Čamo (2016-03-22 22:40)