在Python中是否有用於TDD的特定目錄結構?Python TDD目錄結構
教程說說測試的內容,而不是在什麼地方他們
從周圍的Python Koans戳,懷疑其是這樣的:
/project/main_program.py # This has main method, starts program
/project/classes/<many classes>.py
/project/main_test.py # This simply directs unittest onto tests, can use parameters fed to it to customise tests for environment
/project/tests/<many tests>.py
# to run tests, type "python -m unittest main_test.py" (into a terminal)
# to run program, type "python main_program.py"
我這樣做的權利?是否有一個很好的指導,教導了TDD的目錄層次結構?我聽說有混合的代碼和測試文件是不好的。
參考文獻:
- Are there any good online tutorials to TDD for an experienced programmer who is new to testing?#A編碼道場?嗯......也許我會開始編碼道場網站...
- http://onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html #Shows混合文件
- http://www.youtube.com/watch?v=sD6qzJNQEpE #As偉大的,因爲pyTDDmon看起來,我想先了解基本=)也多數民衆贊成在混合文件
- http://www.slideshare.net/Skud/test-driven-development-tutorial #explains 「設計測試執行測試重複」 只..
- http://blog.cerris.com/category/django-tdd/ #Still沒有幫助...
- http://docs.python.org/library/unittest.html
新手:如果您有結構如上圖所示,然後用/project/tests/testy.py你將不得不「從類進口codeY的」寫在testy.py所以測試/project/classes/codey.py它知道去哪裏看。導入時,python搜索。所以如果你有/cat/sat/on/sometest.py和/cat/trolled/dog/somecode.py,那麼「從cat.trolled.dog導入一些代碼」就會進入測試。 – xxjjnn 2012-03-26 12:03:38