arquillian / arquillian-core

Arquillian provides a component model for integration tests, which includes dependency injection and container life cycle management. Instead of managing a runtime in your test, Arquillian brings your test to the runtime.
http://arquillian.org
Apache License 2.0
372 stars 195 forks source link

Consider adding a `@JunitParam` or something similar which would allow Arquillian to ignore the method parameter #610

Open jamezp opened 2 months ago

jamezp commented 2 months ago
Issue Overview

Both Arquillian and JUnit 5 allow for parameters to be resolved for methods. In #608 we added support for this. However, there could be cases when we want have Arquillian ignore those parameters. For those cases we should we should add parameter, something like @JunitParam or @ArquillianIgnore which will allow other ParameterResolver's to resolve the method parameter.

rhusar commented 2 months ago

Theoretically, if there were to be multiple ParameterResolvers apart from new Arquillian one and the existing JUnit one, the @JunitParam wouldn't be exactly correct. IIUC the annotation is meant to "do not use arquillian parameter resolution for this parameter", so perhaps something like @SkipArquillianParameterResolution or @SkipArquillianParameterResolver? :-)

jamezp commented 2 months ago

Yes, that's where I got @ArquillianIgnore from. I was trying to think of something somewhat short.

rhusar commented 2 months ago

Yes, that's where I got @ArquillianIgnore from. I was trying to think of something somewhat short.

I am afraid it cannot be short without compromising on clarity since stuff like ArquillianIgnore can easily be mistaken for being something else. Sounds to me it should be at least 3 words - @Ignore/Skip-Arquillian-Resolution/Resolver/Parameter

hantsy commented 2 months ago

The JunitParam will be applied on the original Junit parameter injection?

How to keep the compatible with the existing testing libs that already used the JUnit param injection. If we need an explicit qulifier for our Arquillian param injection, I would like to add the annotation to the Arquillian method params. eg. @ArquillianParam, it also can be used for CDI scan to filter the method injections.

jamezp commented 2 months ago

@hantsy Sorry for the delayed response. This is only an issue if there is a conflict to a parameter both JUnit and Arquillian can produce. For example, if you created a JUnit ParameterResolver for URI, Arquillian might be the one injecting the URI instead of your custom ParameterResolver.

What an introduced annotation would do is act like a CDI @Vetoed annotation where Arquillian would not attempt to inject the parameter.