Sorry if I may ask so bluntly, but did you read how TestResource work?

Because if I check in a 2.0 image they works as expected and are only 
initialized once 
per test.

you add the class to 

MyTestCase >> #resources
        ^ Array with: MyResources

and initialize all the values you need in the resources

MyResources >> #setUp
        super setUp
        myValue := #foo

MyResources >> #myValue
        ^ myVale


then in the test case you access the resources via it's singleton pattern

MyTestCase >> #testResourceMyValue
        self assert: MyResources current myValue equals: #foo


and I put a `self halt` in MyResources>>#setUp which only gets called once per 
TestSuite


On 2013-02-28, at 22:31, Noury Bouraqadi <[email protected]> wrote:

> Hi Mariano,
> 
> On 28 févr. 2013, at 20:16, Mariano Martinez Peck wrote:
> 
>> 
>> 
>>> On Thu, Feb 28, 2013 at 2:37 PM, Noury Bouraqadi <[email protected]> 
>>> wrote:
>>> Hi,
>>> 
>>> Jannik and I are having trouble dealing with resources in our robotic 
>>> project.
>>> It's strange that resources are reset on every test run. This happens when 
>>> resources are declared in test class method resources.
>>> 
>>> My understanding of resources is that they should be reset only once for a 
>>> whole test suite.
>>> For every test case, they should be setUp/tearDown, but not fully reset.
>>> 
>> 
>> I don't know what the problem is, but yes, it should be as you said. If this 
>> is not the case, then there is a bug. 
>> wait a minute...what do you mean by "reset" of resources? I guess you mean 
>> #setUp, right? 
>> 
> No, no, it's reset. Meaning that the current instance of the resource is 
> replaced by a new one.
> See :
> 
> TestCase>>run
>       | result |
>       result := self classForTestResult new.
>       [ self run: result ]
>               ensure: [ self classForTestResource resetResources: self 
> resources ].
>       ^ result
> 
> 
>> 
>> We couldn't find a clean way of working this out.
>> We ended up defining our own subclass of TestSuite, which I believe is dirty.
>> Besides, the behavior is kind of random. It seems that there are some 
>> cleanups that aren't performed the right time. But, since the failure is 
>> random, we couldn't manage today to fix this.
>> 
>> 
>> Any hint, idea is welcome,
>> Noury
>> Ecole des Mines de Douai
>> http://car.mines-douai.fr/noury
>> --
>> 
>> 
>> 
>> 
>> Afin de contribuer au respect de l'environnement,
>> merci de n'imprimer ce courriel qu'en cas de necessite
>> 
>> Please consider the environment before you print
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> -- 
>> Mariano
>> http://marianopeck.wordpress.com
> 
> Noury Bouraqadi
> Ecole des Mines de Douai
> http://car.mines-douai.fr/noury
> --
> 
> 
> 
> 


Reply via email to