Hi,

in phpunit there's a @dataProvider annotation, so one method returns a
several data sets for a test method. I'm not sure that's the best design
but it's nice to have one unit test result per data set. See
http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers


Translating the example to Pharo that should give something like:

TestCase subclass: #DataTest

DataTest>>testAdd: a to: b shouldAnswer: c
   <dataProvider: #provider>
   self assert: c equals: a + b

DataTest>>provider
  ^ { {0. 0. 0}.
         {1. 0. 1}.
         {0. 1. 1}.
         {1. 2. 3} }

It may not be to difficult to implement in SUnit. What do you think about
this ?

Laurent


On Sat, Sep 21, 2013 at 1:47 PM, Jan Vrany <jan.vr...@fit.cvut.cz> wrote:

> Hi,
>
> I actually already thought on this as I have similar problems.
> So far I just create a bunch of tests, passing the actual set of
> parameters to a common test method as message arguments.
>
> For different framework (not SUnit, but similar spirit), I introduced a
> notion of "parameter", each having a domain. When running test, the runner
> computes all possible combinations of parameter values and run the test on
> each such combination. I would like to have something similar
> in SUnit, but there are some issues. This is the feature I would like to
> see in SUnit 6.x, but I/we have to finish 5.0 first - I wonder if I ever
> find a time to do push it :-(
>
>
> On 21/09/13 11:06, Noury Bouraqadi wrote:
>
>> Hi,
>>
>> Last ESUG I attended the cool katas session organized by Stephan
>> Eggermont and Laurent Laffont.
>> That was a good opportunity to step back and think about my TDD practices
>> .
>>
>> To experiment with the style proposed by Laurent, I started writing tests
>> for a pong.
>> I ended up having groups of nearly identical tests:
>> -they use exactly the same objects, send the same messages,
>> -but they differ only by values.
>>
>> An example, is testing the motion of the ball towards different
>> directions or collisions with obstacles at different locations or speeds.
>>
>> Now, I wonder what is the best way to express those similar tests?
>>
>> In a short discussion before I leave, Stephane told me about tables of
>> values. It seem that there is such a support in the ruby world in the
>> cucumber framework. Do we have anything similar in Smalltalk world?
>>
>> BTW, the full ESUG conference was great. Thanx to local organizers, and
>> all people that contributed to make it a success.
>>
>> Thanx,
>> Noury
>> Ecole des Mines de Douai
>> http://car.mines-douai.fr/**noury <http://car.mines-douai.fr/noury>
>> --
>>
>>
>>
>>
>>
>>
>
>

Reply via email to