hpi-swa / smalltalkCI

Framework for testing Smalltalk projects with GitHub Actions, GitLab CI, Travis CI, AppVeyor, and others.
MIT License
94 stars 68 forks source link

Cannot execute extensions tag unit tests #615

Closed labordep closed 9 months ago

labordep commented 9 months ago

Hi,

I have three extensions methods on Color class (Pharo 11) in my project. I wrote three unit tests in my project tests package, for example MyProject-Tests, as three ColorTest extensions methods. During the CI test running, I don't know if these tests are executed but probably not. There arent log on these tests in the final result.

Is tests added in extensions are runned ?

image

Thanks.

fniephaus commented 9 months ago

I'm not sure tests defined as extension methods are being picked up but if they aren't listed, they probably aren't. Maybe @theseion has an idea what's going on? Could you provide us with a reproducer so that we can take a look?

theseion commented 9 months ago

They would only be run if you specified ColorTest as part of the testing categories specification:

...
  #testing : {
    #categories : [ 'OpenSmock-Tests', 'Graphics-Tests-Primitives' ]
  }
...

Why did you implement those tests as extensions and not just in your own package?

labordep commented 9 months ago

Hi,

My project is here: https://github.com/OpenSmock/OpenSmock

Basically when I extend a Class with some methods I extend his test Class with same way.

theseion commented 9 months ago

IMO that doesn't make sense. The tests are part of your package. The reason to add extension methods to a class is so that those messages can be sent to the extended objects. This is not true for tests. Granted, in your case you might be testing something specific to colors which might be useful generally, but in general tests for extension methods are about the code that uses the extensions, not the code from the original package.

I don't think that we will add functionality for automatically discovering "extension tests", so I'll close this issue for now. I'm happy to be convinced otherwise though.

labordep commented 9 months ago

Ok thanks ;-)