You can use a TestResource for it, and use some sort of memoization. I don't know if there is a library for memoization in Pharo, but if the HTTP calls are not that many you can implement it by having a cache in the test resource, implemented as a dictionary, with the URL as key and its cached response as value.
Regards, Esteban A. Maringolo El dom., 9 sept. 2018 a las 5:11, Peter Uhnak (<i.uh...@gmail.com>) escribió: > > Hi Ben, > > take a look at TestResource (its comment and subclasses). It should do what > you are looking for. > > Peter > > On Sun, Sep 9, 2018 at 8:08 AM Ben Coman <b...@openinworld.com> wrote: >> >> Say I want to write ten tests for different aspects of a web service point. >> Apart from the risk of relying on an external service, >> I'd like to poll the web service once rather than ten times. >> I wondering about the feasibility of memorizing data between test methods. >> Taking for example... >> TestCase subclass: #MyTest ... >> >> My understanding is that MyTest >> setUp is run once per test method. >> What I guess is missing is a #groupSetup that would be called at the start >> of a running a group of tests. >> >> MyTest >> groupSetup >> memorized := Dictionary new. >> >> MyTest >> getLiveDataOncePerRun >> ^ memorized at: 'data' ifAbsentPut: [ZnClient new get: >> 'http://someservice.com/liveData1'. >> >> MyTest >> test1 >> |data| >> data := self getLiveDataOncePerRun . >> self assert: data result1 equals: 'expected result 1' >> >> MyTest >> test2 >> |data| >> data := self getLiveDataOncePerRun. >> self assert: data result2 equals: 'expected result 2' >> >> cheers -ben >>