How correctly imitate dependencies?
This is continuous of my previous post about why we should imitate our dependencies. I did it not long ago. I though about how do it properly and when I can say that it is correct.
Start from test and real dependencies
I am starting from the tests. I wrote the simple tests which, I though, are correct. That was my learned about dependencies. I had the good situation that I had some prepared tests before. During the writing test I got a knowledge. A lot of time, I verified what the system return. After it, I got the full automated tests for my dependency. Now, I am sure that dependency works like I think. Like my test use it. I think this is a very good advantage.
Extract the interface for communicating
The implementation to communicate is implemented and tested. Our test, if you implement it like functionality test, not code test, should show us, how we want to use our dependency. We know what parameters we use, what methods. We know what we want. That is a place where we must extract the interface, which doesn't change our test. We should only change created object to injected interface (on contractor or using a framework). If you do it, check if your tests still pass. Ok, we can go to the next step.
Implement the interface so that it passes the tests
That should be easy, we know what we want. That is the same like we need to implement every day. We have a requirement, we need to pass it. We have automatically tested it, because we have prepared test. This is why I prefer to do previous steps. Now, we easier implement our code. Our imitate. I tried previous to implement the similar imitate without test. I had a lot of bugs on that, so finally I drop that code. Now, I am sure that I have a working imitate.
This is all
I thought this is very easy. I spend only 2 days to implement it. Of course, this is dependent on complexity of use dependency, but using my way of working I do it faster than I did before. This is why I want to show you my way, which I will use (if I will not find new and better).
ReplyDeleteGreat experience for me by reading this blog. Thank you for the wonderful article.
java interview questions and answers
java interview questions for experienced
java interview questions for freshers
selenium interview questions and answers pdf download
digital marketing interview questions and answers for freshers
hadoop interview questions and answers pdf
oracle sql interview questions
wonderful article with amazing facts an ideas. thank you for such incredible blog.
ReplyDeletesalesforce training in chennai
software testing training in chennai
robotic process automation rpa training in chennai
blockchain training in chennai
devops training in chennai
"Valuable one...thanks for sharing..
ReplyDeleteSpoken English Classes in Tambaram
Spoken English Classes in Anna Nagar
Spoken English Classes in Velachery
spoken english class in t nagar
Spoken English Classes in Porur
Spoken English Classes in OMR
Spoken English Classes in Chennai
Wow, it’s very helpful blog for comments. Will try to follow all these stuff!
ReplyDeleteKeep upgrading.
Java Training in Chennai
Java Course in Chennai
I feel happy to visit this blog. Gathered lots of information here. Do share more.
ReplyDeleteBlue Prism Training in Chennai
Blue Prism Online Training
Blue Prism Training in Bangalore
UiPath Training in Chennai
UiPath Training in Bangalore
You just made my day by writing on how can we enable Page Link in Oracle Apps R12. Thumbs up for this brilliant information. Have a good day. Dissertation Writing Services
ReplyDeleteInformative content,thanks for sharing...waiting for next update.
ReplyDeleteIBM Training in Chennai
IBM Course in Chennai