|
|||||||||||
|
RE: Connection class reorg in a testable state
From: Joel Fielder <joel.fielder(at)switchplane.com>
Date: Thu Jul 19 2007 - 14:12:39 EDT
Firstly, to clarify, I didn't realise that dtest was in fact running these other test programs as well - I thought it was just comparing the good known output against the current example program outputs. In my mind that's not quite the same level of confidence as it tests the high level whereas what I'm talking about is the low level granular stuff that you've just introduced. Despite that, I still think UnitTest++ could bring a lot to the project. First of all, the mandatory testing issue. I don't really think that's a problem as mostly the people who will be using it are going to be those who are actively contributing to the library i.e. the target audience here is the hackers, not the users. That's not many people compared with the number of people who have problems simply finding readme/google so I don't believe it would generate noise. Additionally, it's quite easy to change the UnitTest++ makefile to remove the building and the running of the test application. I'm pretty sure there's no licensing issue with that and if there is we could submit a patch with a "no-post-build-test" target. So, I'm not necessarily proposing using it to replace the exercising of the examples - I suppose that's more of an integration test as it's working against a real server. But I am proposing using it for what's currently in the test subdirectory, for these reasons:
You could say that dtest has all of those except for number 1, but I'm not sure there's any reason to re-invent the wheel. Wouldn't it be easier to convert to UnitTest++ rather than spend ages re-implementing all of its nice features? Additionally, I think it would add credibility. People like software that's test driven because it's a real measure of quality, but if you roll your own they might not have quite the same confidence as with something that's in widespread use, even if it's comparable. > If your concern is that we don't yet have 2000 tests, get coding. :) Yup, this is a concern, and I do love a juicy target. > I don't see it as a good way to make MySQL++ database-independent. Well surely if you want to be able to test it and to use it for real, you've got to have a dummy database driver and a real one, and they must expose the same interface (i.e. implement IDatabaseDriver or whatever). Doesn't the writing of tests to check that it sent the right query force the development of the real thing also? If I was going to start database independence, I'd do something like this before even thinking about how I was going to change the library:
TEST(ItRunsTheQuery)
TestDatabaseDriver driver; Connection connection(TCPConnection(whatever),driver); std::string sql = "SELECT * FROM `query"; Query q = connection.Query(); q << sql; q.execute(); CHECK_EQUAL(driver.GetLastQuery(),sql);} This is one of the major benefits of test driven development - the high granularity of the testing forces the removal of dependencies which creates a nice flexible design. For example, it would be nice to remove #include "mysql++.h" from row's header so that when I create a functor which acts on a row, it doesn't have to include the whole of mysql. End of essay. Joel -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=lists@pantek.comReceived on Thu Jul 19 14:10:40 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:28:32 EDT |
||||||||||
|
|||||||||||