Hi Jakob,<br>
<br>
please find the attached changeset, which revises the changes, allows the user to edit the new test case definition before creating it, and uses the 'KernelTests-Objects' pattern for test category derivation which is known from most Trunk packages. No further heuristics for related class search are included. I also revised the logic for subclass templates in the Kernel package a bit. If you like it, I can merge it into the Trunk. :-)<br>
<br>
(At a later point in time, we might want to create a hook in the ToolSet for creating a new subclass and also make use of it in Parser>>#defineClass:. But for now, I think the change is fine.)<br>
<br>
<b>=============== Diff ===============</b><br>
<br>
<b>BasicClassOrganizer>>categoryForTestCases {*SUnitTools-accessing} · jr 3/5/2020 22:07</b><br>
<font color="#FF0000">+ categoryForTestCases<br>
+     ^ self categories<br>
+         detect: [:each | each beginsWith: 'test']<br>
+         ifNone: [Categorizer allCategory]</font><br>
<br>
<b>Browser>>newClassContents {accessing} · ct 1/16/2022 20:57 (changed)</b><br>
newClassContents<br>
<s><font color="#0000FF">-     | theClassName |<br>
-     ^ (theClassName := self selectedClassName)<br>
-         ifNil:<br>
-             [Class template: self selectedSystemCategory]<br>
-         ifNotNil:<br>
-             [Class templateForSubclassOf: theClassName asString category: self selectedSystemCategory]<br>
</font></s><font color="#FF0000">+ <br>
+     ^ self selectedClass<br>
+         ifNil: [Class template: self selectedSystemCategory]<br>
+         ifNotNil: [:theClass | theClass templateForSubclassInCategory: self selectedSystemCategory]</font><br>
<br>
<b>Class class>>template: {instance creation} · ct 1/16/2022 21:19 (changed)</b><br>
<s><font color="#0000FF">- template: aSystemCategoryName <br>
</font></s><font color="#FF0000">+ template: systemCategoryName <br>
</font>    "Answer an expression that can be edited and evaluated in order to define a new class."<br>
<br>
<s><font color="#0000FF">-     ^ self templateForSubclassOf: Object name category: aSystemCategoryName <br>
</font></s><font color="#FF0000">+     ^ Object templateForSubclassInCategory: systemCategoryName</font><br>
<br>
<b>Class class>>templateForSubclassOf:category: {instance creation} · ct 1/16/2022 20:58 (changed)</b><br>
templateForSubclassOf: priorClassName category: systemCategoryName <br>
    "Answer an expression that can be edited and evaluated in order to define a new class, given that the class previously looked at was as given"<br>
<br>
<font color="#FF0000">+     self deprecated: 'ct: Use Class >> #templateForSubclassInCategory:'.<br>
</font>    ^priorClassName asString, ' subclass: #NameOfSubclass<br>
    instanceVariableNames: ''''<br>
    classVariableNames: ''''<br>
    poolDictionaries: ''''<br>
    category: ''' , systemCategoryName asString , ''''<br>
<br>
<b>Class>>templateForSubclassInCategory: {subclass creation} · ct 1/16/2022 21:19</b><br>
<font color="#FF0000">+ templateForSubclassInCategory: categoryName<br>
+     "Answer an expression that can be edited and evaluated in order to define a new class."<br>
+ <br>
+     ^ self<br>
+         templateForSubclassNamed: #NameOfSubclass<br>
+         category: categoryName</font><br>
<br>
<b>Class>>templateForSubclassNamed:category: {subclass creation} · ct 1/16/2022 21:19</b><br>
<font color="#FF0000">+ templateForSubclassNamed: subclassName category: categoryName<br>
+     "Answer an expression that can be edited and evaluated in order to define a new class."<br>
+ <br>
+     ^ '<1p> subclass: <2p><br>
+     instanceVariableNames: ''''<br>
+     classVariableNames: ''''<br>
+     poolDictionaries: ''''<br>
+     category: <3p>' expandMacrosWithArguments:<br>
+         {self. subclassName asSymbol. categoryName}</font><br>
<br>
<b>CodeHolder>>testBrowseClassNamed:possibleMessageNamed: {*SUnitTools-running} · ct 1/16/2022 21:15 (changed)</b><br>
testBrowseClassNamed: aClassName possibleMessageNamed: aMessageName<br>
    <br>
    | cls selector |<br>
<s><font color="#0000FF">-     (self class environment hasClassNamed: aClassName) ifFalse: ["no dice" ^ self].<br>
</font></s><font color="#FF0000">+     (self class environment hasClassNamed: aClassName)<br>
+         ifFalse: [^ false].<br>
</font>    cls := self class environment classNamed: aClassName.<br>
<br>
    (aMessageName notNil and: [cls includesLocalSelector: (selector := aMessageName asSymbol)])<br>
        ifTrue: [ToolSet browse: cls selector: selector]<br>
<s><font color="#0000FF">-         ifFalse: [ToolSet browseClass: cls].<br>
</font></s><font color="#FF0000">+         ifFalse: [ToolSet browseClass: cls category:<br>
+             cls organization categoryForTestCases].<br>
+     <br>
+     ^ true</font><br>
<br>
<b>CodeHolder>>testFindTest {*SUnitTools-running} · ct 1/16/2022 21:21 (changed)</b><br>
testFindTest<br>
    | cls destClassName destMessage |<br>
    cls := self selectedClass ifNil: [^ self].<br>
    destClassName := cls name asString, 'Test'.<br>
    destMessage := self selectedMessageName ifNotNil: [:name | self testSelectorFrom: name].<br>
<s><font color="#0000FF">-     self testBrowseClassNamed: destClassName possibleMessageNamed: destMessage<br>
</font></s><font color="#FF0000">+     <br>
+     (self testBrowseClassNamed: destClassName possibleMessageNamed: destMessage)<br>
+         ifTrue: [^ self].<br>
+     (Project uiManager<br>
+         chooseFromLabeledValues: (OrderedDictionary new<br>
+             at: 'Create test case' translated put: [self testMakeTestCaseClassFor: destClassName];<br>
+             at: 'Cancel' translated put: [];<br>
+             yourself)<br>
+         title: ('There is no test for {1}' translated<br>
+             format: {self selectedMessageName ifNil: [cls]})) value.<br>
</font><br>
<br>
<b>CodeHolder>>testMakeTestCaseClassFor: {*SUnitTools-running} · ct 1/16/2022 21:21</b><br>
<font color="#FF0000">+ testMakeTestCaseClassFor: className<br>
+ <br>
+     | category template |<br>
+     self selectedClassOrMetaClass ifNil: [^ self].<br>
+     self okToChange ifFalse: [^ self].<br>
+     <br>
+     category := (self selectedClass category findTokens: $-) in: [:testedCategoryTokens |<br>
+         ({testedCategoryTokens first , 'Tests'} , testedCategoryTokens allButFirst)<br>
+             joinSeparatedBy: $-].<br>
+     template := TestCase<br>
+         templateForSubclassNamed: className<br>
+         category: category.<br>
+     (Browser fullOnCategory: category)<br>
+         editSelection: #newClass;<br>
+         contentsChanged;<br>
+         changed: #editString with: template.</font><br>
<br>
Best,<br>
Christoph<br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font><br>
<br>
On 2022-01-10T18:24:35+01:00, jakres+squeak@gmail.com wrote:<br>
<br>
> Since there are so many different combinations you can probably make this<br>
> arbitrarily complex. Then 7/8 of the feature are the guessing of the<br>
> category.  The question is whether it is worth it.<br>
> <br>
> You could search all registered packages that start with the same stem for<br>
> subclasses of TestCase. That may introduce some unwanted dependency between<br>
> trunk packages, so you may want to stick to categories rather than packages<br>
> instead. You may program for the known patterns, so add your *Tests-*<br>
> pattern to the list. Which one comes next? If there is no existing test<br>
> category with the stem, which of the conventions do you choose?<br>
> <br>
> Per KISS I would stick to just one convention, which can also be the one<br>
> you mentioned rather than the one I implemented. Changing the category of<br>
> the class afterwards should be easy enough.<br>
> <br>
> <christoph.thiede at student.hpi.uni-potsdam.de> schrieb am Mo., 10. Jan.<br>
> 2022, 18:02:<br>
> <br>
> > Hi Jakob,<br>
> ><br>
> > while reviewing this patch, I noticed that the category heuristic does not<br>
> > work in all situations. For example, it classifies a newly created<br>
> > WideSymbolTest under Collections-Tests rather than CollectionTests-Text. Do<br>
> > you have an idea how to improve the heuristic (e.g., search for other test<br>
> > classes in the same package, ...)? :)<br>
> ><br>
> > Best,<br>
> > Christoph<br>
> ><br>
> > ---<br>
> > *Sent from **Squeak Inbox Talk<br>
> > <https://github.com/hpi-swa-lab/squeak-inbox-talk>*<br>
> ><br>
> > On 2020-03-07T14:08:02+00:00, christoph.thiede at student.hpi.uni-potsdam.de<br>
> > wrote:<br>
> ><br>
> > > Ah, ok :-)<br>
> > ><br>
> > > <http://www.hpi.de/><br>
> > > ________________________________<br>
> > > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im<br>
> > Auftrag von Jakob Reschke <forums.jakob at resfarm.de><br>
> > > Gesendet: Samstag, 7. März 2020 14:57:12<br>
> > > An: The general-purpose Squeak developers list<br>
> > > Betreff: Re: [squeak-dev] The Inbox: SUnitTools-jr.5.mcz<br>
> > ><br>
> > ><br>
> > ><br>
> > > Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de<br>
> > <mailto:Christoph.Thiede at student.hpi.uni-potsdam.de>> schrieb am Sa.,<br>
> > 7. März 2020, 14:31:<br>
> > ><br>
> > > What is the reason to use ClassBuilder instead of<br>
> > #subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:?<br>
> > ><br>
> > > The ability to specify the target environment.<br>
> > > -------------- next part --------------<br>
> > > An HTML attachment was scrubbed...<br>
> > > URL: <<br>
> > http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200307/0bf3af36/attachment.html<br>
> > ><br>
> > ><br>
> > ><br>
> ><br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220110/790ecbf5/attachment.html><br>
> <br>
> <br>
["makeTestCaseClass.2.cs"]<br>
["makeTestCaseClass-1-ask.png"]<br>
["makeTestCaseClass-2-define.png"]