On 9/14/2010 6:23 AM, Jean-Christophe Fillion-Robin wrote:
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 ?
We have done this in two ways:
1. Create the process outside of the ctest framework.
Drive the test with a .sh or .bat file, and at the beginning before
you run ctest, you start the server process. At the end you end the
process.
2. Start/Stop the server with each test. I think this is how paraview
client server tests work. We created a TestDriver application that
starts the server, then runs the test, then stops the server.
There is no cross platform way to do 1 with in ctest, but it might be a
nice feature. A startup process could be specified. This does not yet
exist, or even have a plan to exist, but might be a good idea someday.
If you would be interested in implementing something like this... :)
-Bill
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake