Re: [qmtest] Context variables for test databases
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qmtest] Context variables for test databases



nathan@xxxxxxxxx wrote:
Hi,

I'm wondering if QMTest has any way to pass context variables (or something similar) to test databases so that the test databases can use these values while figuring out what tests they contain.  Basically, I'd like to pass parameters to databases at load time rather than at creation time.

A context is meant to be used to provide runtime information to tests. In contrast, the structure and content of a test database is not supposed to be runtime-configurable.

The use case I'm thinking of here is using shared libraries, which are built from my own code, as test databases (specifically, I'd like to use CppUnit test DLLs).  The problem is that, at least in the build system I'm currently using, the shared libraries won't be in one fixed location that can be hard coded into a test database when it is created.  Instead, they could be in pretty much arbitrary locations based on things like the build configuration, build directory location, install directory location, etc.

I haven't used CppUnit yet, and so I may misreading what you are saying. Specifically, I'm not sure what you mean by "using shared libraries...as test databases". Are you saying that the information about what tests exist is to be obtained by making calls into a (shared) library ?

I think I need to understand a little better what you mean in order to be able to suggest how to bind that to QMTest.

What I would like to be able to do is to pass something like a binary path to QMTest that test databases could use to find the shared libraries.  However, the only way I can think of to do this right now is to use environment variables.
Again, I may not understand in what way you want to use shared libraries. The most common case (which I have implemented already a couple of times with QMTest) is to have a set of tests consisting of source code that needs to be compiled and linked, so the test is a 'CompilationTest', and paths to required libraries can easily be provided by context variables. However, none of this affects the test database structure itself, so only the tests themselves need to know about these variables.

I have also set up test databases where required variables were provided by the QMTest/configuration file. That file was generated via configure (i.e., autoconf), and so any required paths could be stored there at configure time.

Let me know if any of this helps, or if I misunderstand what you are trying to achieve.

Thanks,
      Stefan

--
Stefan Seefeld
CodeSourcery
stefan@xxxxxxxxxxxxxxxx
(650) 331-3385 x718