pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Better Modularity for TESTS / Unification of test packages

Open astares opened this issue 1 year ago • 1 comments

We should follow the simple guideline that TESTS should be separated from RUNTIME code. Because when you want to have a modular and minimal system you might only want to use packages with the RUNTIME code and only load/use the tests during development phase.

This is easily achieved by packaging the test classes into an own separate package.

Now we have many tests in Pharo and the typical pattern is to package them into a separate package with the additional extension "-Tests". So if you have an application like "MyKillerApp" you might have

MyKillerApp-Core MyKillerApp-UI

with either MyKillerApp-Core-Tests MyKillerApp-UI-Tests

or a common MyKillerApp-Tests package.

Unfortunately not all test classes follow that best practice and we have 64 violations of this simple rule:

| testClasses violating |
testClasses := TestCase allSubclasses reject: [ :each | each isAbstract ]. "Ignore abstract"
violating := testClasses reject: [:each | each package name endsWith: '-Tests' ]. "Ignore proper packages ones"
violating collect: [:each | each -> each package name ]

which gives 64 viiolations in Pharo 13.

We should clean them and add a release test so the test classes are properly packaged.

astares avatar May 13 '24 14:05 astares

Here is the list:

  • HashTesterTest->#'SUnit-Core'
  • BehaviorWithCompilerTest->#'Kernel-Tests-WithCompiler'
  • RuntimeSyntaxErrorTest->#'Kernel-Tests-WithCompiler'
  • SelfEvaluatingObjectTest->#'Kernel-Tests-WithCompiler'
  • DiskFileAttributesTest->#'FileSystem-Tests-Attributes'
  • FileAttributesPluginPrimsTest->#'FileSystem-Tests-Attributes'
  • FileReferenceAttributeTest->#'FileSystem-Tests-Attributes'
  • RGPackageDefinitionTest->#'Ring-Definitions-Tests-Containers'
  • CoverageCollectorTest->#Coverage
  • RBTestAsDataForExtractSetupTransformationTest->#'Refactoring-DataForTesting'
  • MetacelloCoreIssue125TestCase->#'Metacello-TestsCore'
  • MetacelloCoreSymbolicVersionTest->#'Metacello-TestsCore'
  • MetacelloCoreVersionQueryTestCase->#'Metacello-TestsCore'
  • MetacelloLockTest->#'Metacello-TestsCore'
  • MetacelloSpecTestCase->#'Metacello-TestsCore'
  • MetacelloReferenceTestCase->#'Metacello-TestsReference'
  • NoUnusedVariablesLeftTest->#ReleaseTests
  • ProperMethodCategorizationTest->#ReleaseTests ProperPackagesTest->#ReleaseTests
  • ProperlyImplementedSUnitClassesTest->#ReleaseTests
  • ProtocolConventionsTest->#ReleaseTests CommentTestCase->#PharoDocComment
  • ZnImageExampleDelegateTest->#'Zinc-HTTP-Examples'
  • ZnKeyValueStoreTest->#'Zinc-HTTP-Examples'
  • ZnPrefixMappingDelegateTest->#'Zinc-HTTP-Examples'
  • ZnReadEvalPrintDelegateTest->#'Zinc-HTTP-Examples'
  • ZnStaticFileDecoratorDelegateTest->#'Zinc-HTTP-Examples'
  • ZnStaticFileServerDelegateTest->#'Zinc-HTTP-Examples'
  • ZnUrlShortnerDelegateTest->#'Zinc-HTTP-Examples'
  • SystemDependenciesTest->#'System-DependenciesTests'
  • RSFlowCanvasTest->#'Roassal-Mondrian'
  • StFontChooserPresenterTest->#'NewTools-FontChooser'
  • SpTextPresenterDecoratorMorphicAdapterTest->#'NewTools-SpTextPresenterDecorators
  • ' SpTextPresenterDecoratorTest->#'NewTools-SpTextPresenterDecorators'
  • StHaltAndBreakpointControlTest->#'NewTools-Debugger-Breakpoints-Tools'
  • StHaltBreakpointInspectionItemTest->#'NewTools-Debugger-Breakpoints-Tools'
  • StObjectBreakpointInspectionTest->#'NewTools-Debugger-Breakpoints-Tools'
  • DTCoverageMockTest->#'DrTests-TestCoverage-Tests-Mocks'
  • BCBeautifulCommentsSettingsTest->#BeautifulComments
  • ClassHierarchyPrinterTest->#'Kernel-ExtraUtils'
  • ConfigurationCommandLineHandlerTest->#Deprecated12
  • MetacelloRepositorySqueakCommonTestCase->#'Metacello-TestsMCCore'
  • ObsoleteTest->#ReleaseTests ReleaseTest->#ReleaseTests
  • MetacelloSemanticVersionNumberTestCase->#'Metacello-TestsCore'
  • MetacelloVersionNumberTestCase->#'Metacello-TestsCore'
  • MetacelloGroupSpecTestCase->#'Metacello-TestsCore'
  • MetacelloPackagesSpecTestCase->#'Metacello-TestsCore'
  • MetacelloProjectReferenceSpecTestCase->#'Metacello-TestsCore'
  • MetacelloProjectSpecTestCase->#'Metacello-TestsCore'
  • MetacelloValueHolderSpecTestCase->#'Metacello-TestsCore'
  • MetacelloVersionSpecTestCase->#'Metacello-TestsCore'
  • MCGitBasedNetworkRepositoryTest->#'Metacello-TestsMCCore'
  • MetacelloPackageSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloRepositoriesSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloRepositorySpecTestCase->#'Metacello-TestsMCCore'
  • StHaltAndBreakpointControllerTest->#'NewTools-Debugger-Breakpoints-Tools'
  • StHaltCacheTest->#'NewTools-Debugger-Breakpoints-Tools'
  • MetacelloMCGroupSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloMCPackagesSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloMCProjectReferenceSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloMCProjectSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloMCValueHolderSpecTestCase->#'Metacello-TestsMCCore'
  • MetacelloMCVersionSpecTestCase->#'Metacello-TestsMCCore'

astares avatar May 13 '24 14:05 astares