<div>On Tue, 16 Aug 2022 at 21:56 Hernan Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com">hernan.wilkinson@10pines.com</a>> wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div dir="ltr">hmm just to clarify, cmd+t is not only for unit tests... it runs the test that you are browsing. And cmd+y runs all the tests on the category...</div></div></blockquote><div dir="auto"><br></div><div dir="auto">Yes, but doesn’t work for tests that require some extra context. For example, say we have a MatrixTest with an instance variable ‘scalars’ that tests matrices over a given coefficients ring, and a test method testDeterminantProduct that creates two random matrices A and B and asserts that (A*B) determinant = (A determinant * B determinant). I cannot just run the test with cmd-t or cmd-y without specifying a ring of coefficients. I came up with two possible ways to implement concrete tests:</div><div dir="auto">1) I make MatrixTest abstract (see TestCase class>>isAbstract) and make many concrete subclasses that implement #initialize and set ‘scalars’ to particular rings (for example a MatrixOverIntegersTest that sets scalars to Z). I’m currently doing this. The drawback of this approach is that I end up with lots of subclasses that only implement #initialize to set the scalars.</div><div dir="auto">2) I don’t make subclasses of MatrixTest, and instead build test suits by instantiating MatrixTest for each coefficients ring I want to test and each test selector.</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto">Another way to achieve what I need is to copy the test case instead of creating a new one. Just need to implement<br></div><div dir="auto"><br></div><div dir="auto">TestCase>>copy</div><div dir="auto">    ^ self class selector: testSelector</div><div dir="auto"><br></div><div dir="auto">And in my subclasses I can make sure to copy all the additional state.</div></blockquote><div><br></div><div>That makes sense... and the #debug would do a copy, is that the idea?</div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Yes. I’d prefer if the system didn’t assume it can recreate a test case from the class and test selector alone. <span style="color:rgb(0,0,0)">But for now I can continue without any changes to Cuis, it’s the simplest thing to do, I’ll continue including those two methods for TestCase in my package.</span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div class="gmail_quote"><div></div></div></div></blockquote><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="auto"> Also I’d have to implement #isSameAs: in my subclasses</div></blockquote><div><br></div><div>Why?</div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Because two instances of MatrixTest for #testDeterminantProduct but with different scalars are different, for example one might test the determinant of matrices over the integers while other tests the determinant over the rationals (same testSelector, different scalars).</div><div dir="auto"><br></div><div dir="auto"><br></div></div></div>