That seems to be exactly what I'm looking for. Thanks Peter. cheers -ben On Sun, 9 Sep 2018 at 16:11, Peter Uhnak <i.uh...@gmail.com> wrote:
> 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 >> >>