pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.19k stars 351 forks source link

Better Modularity for TESTS / Unification of test packages #16607

Open astares opened 3 months ago

astares commented 3 months ago

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 commented 3 months ago

Here is the list: