Re: [Pyunit-interest] Unitesting organisation
Brought to you by:
purcell
|
From: Joel Q. <joe...@ho...> - 2001-10-30 10:17:11
|
You are right for the testing method. I think I need to write an other configParser because, url are specify in it. These url are used by some other script download web page. I think to use an other configParser with url pointing to a local web site on my machine to provide test page. What do you think about that phylosophy ? Joel ----- Original Message ----- From: "Ype Kingma" <yk...@xs...> To: "Joel Quinet" <joe...@ho...> Sent: Saturday, October 27, 2001 10:42 AM Subject: Re: [Pyunit-interest] Unitesting organisation Joel, >Hi all, > >I am new to unitTesting practice, I start using it after having red some >article on >Extreme Programming. I have start to implement it in an application I am >currently >writing. I need to do that to be able to improve it quicker, avoid spending >time in >debugging due to change. I ask myself many question about that. > >I have an application in Python to download web pages and extract some data >from them. > >At starting point, I have used a configfile with the configParser Python >object. >Due to many value are not changing frequently (principaly url), I have put >those >variable directly in the Python code. Now, I have the following solution, a >configfile >and an object (which use the configParser object to parse the file) >containing more >constant variable in it. I have also implemented the singleton pattern in >this object, >this permit to avoid the parsing of the config file every time. > >I have implemented the folowing stuff: >- I have put my test file in the same folder as the code file. >- I use the httpServer in python to have a web server for testing > >My interrogation are : >- should I implement a testing configfile and a testing parser object which >contains variable too ? That depends on what you want to test. In case you want to test that your code is using the right configuration you will need a separate testing configuration to compare to. However, there is no point in writing another configuration parser. You can test your configuration parser by feeding it a known configuration and compare it's output to some expected parsed configuration data. > - What is the best solution to avoid name file conflict ? Use a naming convention for your files. Eg. for testing cfg.py you can use cfgtests.py, that is systematically add a 'tests' suffix to the name. You can also put the test files in a separate directory. Such measures will allow you to collect many unittests lateron easily into a longer regression test. >- Should I implement other way to put my testfile ? I'm not sure what you mean here, but I may have answered this question already. >This is my current question. I hope to be clear enough (English is not my >mother language). Pas de problème. Have fun, Ype |