Reading Test Driven Development with Python by Harry Percival (Part 3)
Unit test vs functional test
Now that I have the correct version of the textbook, we are back at it again! Today we are actually writing views and urls!
Thanks to the practice in previous series: Learning Django, I have a good idea how to do that…. so I thought.
Man this chapter really broke it down for me.
So Last chapter we broke down how the user will be using the website and wrote a functional test for it. So what I learn that the functional test will be able to help with the big picture stuff. I did wonder how this is test driven development if we still have to write inner working of the code like models and what not. This chapter answered that.
So after we written our functional test, now we write the unit tests, this is how us the programmers see the website. The unit test we wrote in the chapter we test if the views can find a home page with the correct name.
The detail the test went off on, we went from creating a homepage=none and ran the test, to def home_page() and ran the test. The way this approach work just takes one baby steps at a time and I never thought of I can write views this way.
This method (style? strategy?) is so cool, that really made me appreciate django, or python in general, so much more!! We are being a goat and doing the tests!!