[Cuis-dev] Tests

Hernan Wilkinson hernan.wilkinson at 10pines.com
Tue Aug 16 06:44:21 PDT 2022


Hi Luciano, Juan,
 using the same test instance to debug breaks the "test isolation"
rule, can bring problems if the test is not well written, etc.
 I think that if you have test data that you want to use to debug a test
you could put that data in class variables or something like that, not in
instance variables. Would that work for you? Or you can apply the change
you suggest for the test cases that you want that behavior, I mean redefine
#debug as you suggested in your .cs for the test case you want that
behavior.
 I think it is not a good idea to use that behavior for all test cases.

 Regarding the test runner, I usually run the tests with cmd+t not the test
runner, but it makes sense what you suggest to open the debugger in that
case.

Cheers!
Hernan.

On Tue, Aug 16, 2022 at 10:16 AM Juan Vuletich <juan at cuis.st> wrote:

> Hi Luciano,
>
> On 8/15/2022 6:48 AM, Luciano Notarfrancesco via Cuis-dev wrote:
> > I have subclasses of TestCase that hold more state besides the test
> > selector. For example I have a subclass with a 'seed' instance
> > variable that is set randomly in >>#initialize, and a 'random'
> > instance variable that is set to 'Random seed: seed' in >>#setUp. This
> > allows me to write tests that use randomness and are reproducible. But
> > when debugging a test that failed, a new TestCase instance is created
> > and the new TestCase is debugged instead, so the original seed is lost
> > and my tests are not reproducible. I'm also experimenting with generic
> > tests, for example I have a generic VectorSpaceTest with an instance
> > variable 'scalars' for the coefficients field, so I can create a test
> > suit with tests for vector spaces over the rationals, Z/pZ, rational
> > functions, etc (vector spaces over different 'scalars'), but again the
> > scalars are lost when I try to debug a test. I don't see any reason to
> > create new instances of the test cases when debugging, see the
> > attached change set and let me know if you agree with it.
>
> I'd defer to Hernán and others who may have an opinion. I don't know if
> reusing the test instance could bring problems. Besides, any test I
> write is repeatable, setting Random seeds as needed. I guess you must
> have your reasons to do otherwise...
>
> > Also, when a test was taking too long I used to click the stop button
> > in the test runner and a debugger would open, so I what it was doing.
> > But now the test runner just stops without opening a debugger.
>
> Maybe you were doing cmd-. to interrupt the process? I don't remember
> [stop] opening a debugger. It is easy to do, though:
>
> terminateRun
>      running debugWithTitle: 'Interrupted Test'
>
> If people agree, I can integrate this change.
>
> >
> > Thanks,
> > Luciano
>
> Cheers,
>
> --
> Juan Vuletich
> cuis.st
> github.com/jvuletich
> researchgate.net/profile/Juan-Vuletich
> independent.academia.edu/JuanVuletich
> patents.justia.com/inventor/juan-manuel-vuletich
> linkedin.com/in/juan-vuletich-75611b3
> twitter.com/JuanVuletich
>
>

-- 
<https://10pines.com/>Hernán WilkinsonSoftware Developer & Coach

Alem 896, Floor 6, Buenos Aires, Argentina

+54 11 6091 3125

@HernanWilkinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220816/367047dd/attachment.htm>


More information about the Cuis-dev mailing list