The Artima Developer Community
Sponsored Link

Design Forum
The right place of unit tests in the project

2 replies on 1 page. Most recent reply: Feb 20, 2006 2:25 PM by Vladimir Nesov

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
artem kondratyev

Posts: 2
Nickname: artemk
Registered: Jan, 2006

The right place of unit tests in the project Posted: Jan 16, 2006 2:12 AM
Reply to this message Reply
Advertisement
Reading articles and forums topics on different sites I've found out that the common practice is to separate tests from the production code putting them into separate folders, namespaces and furtermore, in the separate modules.

It seems strange a bit for me - because I think it is good idea to have unit tests to be well-integrated with the code. Otherwise it can cause the code and tests to get unsynchronized. In the case the project can be built excluding tests developers could stop to write tests for some time assuming they could have some more time in the future to get back to tests.

Another reason to put the code and tests together is resulted from following assertions:
1. Tests are the best documentation (after code itself)
2. It is better to put the most of documentation right into the code than into the separate document

And finally, what is the good reason to exclude tests from distribution assembly except the size reduction? Why to reject the ability to run tests on the client computer and to get sure the code still pass them successfully?

I use to place tests in the same folders and namespaces as classes what are being tested. Is there any significant reason not to do so?


Chad Gorshing

Posts: 12
Nickname: gorshing
Registered: Jun, 2004

Re: The right place of unit tests in the project Posted: Jan 16, 2006 7:32 PM
Reply to this message Reply
Personally I do not feel that Unit Tests help document the code. I understand that well written code can be self documenting, however majority of the time I have to write a users manual. So I fail to see any benefit in having the Unit Tests help with code documentation.

I also fail to see why anybody would want to publish tests for production quality code. I can't really think of too many (actually none) people/companies that do this. To me Unit Tests (among other types of testing) are used just for that phase. I do not see people publishing their design documentation.

But I would also like to hear other peoples opinions.

Vladimir Nesov

Posts: 27
Nickname: robotact
Registered: Aug, 2005

Re: The right place of unit tests in the project Posted: Feb 20, 2006 2:25 PM
Reply to this message Reply
Tests are good documentation, but it's mostly not required when interface is already in complete state. Tests are usually for regression testing, and it's unlikely that library'll get changed by users. It's reasonable to include tests if there are major portability issues.
If tests are separated, there is a simple option of excluding them. At least there is no reason to include them in binary.

Flat View: This topic has 2 replies on 1 page
Topic: Wanted: E-commerce web designers for North American site Previous Topic   Next Topic Topic: design pattern

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use