[qmtest] Questions [context scope, prerequisites enforcement]
Stefan Seefeld
stefan at codesourcery.com
Fri Apr 11 13:11:29 UTC 2008
Mohamed Barwani wrote:
> Thanks Stefan!
>
> Question 2 solved..
>
> Stefan Seefeld wrote:
>> Hi Mohamed,
>>
>> Mohamed Barwani wrote:
>>> Hello there..
>>>
>>> _1_ Am trying to get my head around python.. Looking at the context
>>> variable I can easily create new items it in a 'resource' object,
>>> but not in a 'test' object.
>>
>> All context variables live in the Context object, which is passed to
>> Resource.SetUp() as well as Test.Run(), where you can access as well
>> as modify them.
>
> An example would illustrate what I mean. test_a sets a context variable,
> where test_b tries to use it.
That doesn't work:
First, as I mentioned in my last mail, your dependent test must not rely
on prerequisite tests having been run at the time it is executed.
Second, those tests don't share the same context object, and thus can't
use it to communicate state. In fact, *no* two tests should depend on
each other. That's just how QMTest is designed.
However, the context object is shared between a test and its resource
objects, so whatever changes a prerequisite resource applies to a
context will be propagated to the subsequent test run. (See
http://www.codesourcery.com/public/qmtest/qmtest-snapshot/share/doc/qmtest/html/tutorial/concepts-context.html)
Regards,
Stefan
--
Stefan Seefeld
CodeSourcery
stefan at codesourcery.com
(650) 331-3385 x718
More information about the qmtest
mailing list