[CMake] How to test classes requiring a server ?

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Tue Sep 14 06:23:29 EDT 2010


Hi Folks,

Would be great if some people having experience in testing classes required
a server could share their knowhow :)

Within our project, we have a set of classes that required an instance of a
server running to be properly unit tested.

Note that the server can be started easily from a command line, no
installation steps are required.

The ideas are the following:

1) Start the server at the beginning of each unit test / kill it at the end
  => The project depending on Qt, we could use QProcess to start the server
and kill it ...
  => We need to make sure port are unique for each test ( to properly handle
parallel testing and multiple dashboard running at the same time ... ).  We
were thinking to may be rely on an environment variable used as a counter
...

2) -> have a "initialize_server" test in charge of starting the server
     -> run all unit test against the same instance of the server  (all
tests would be run sequentially)
     -> have a "finalize_server" test in charge of killing/stopping the
server: Is there a cross-platform way of stopping a previously started
process in ctest ?


Thanks for your suggestions
Jc

-- 
Phone: 1-518-836-2174
Ext: 304
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100914/98bff1ba/attachment.htm>


More information about the CMake mailing list