Gerhard, RE the original question. If a scope is applied to the test class, does it handle it correctly? E.g. if its request scoped and each test method starts a new request context, is a new instance used? Or is it treated as a dependent bean regardless?
John On Mon, Nov 20, 2017 at 6:52 AM Gary Hodgson <[email protected]> wrote: > Hi Gerhard, > > I can understand the desire not to confuse the reader, but I think there is > more risk of confusion by not documenting this. For example, I came across > the problem because we use Database Rider to setup DBUnit, and > documentation in this downstream project explicitly advises to set the > property to true ( > https://database-rider.github.io/getting-started/#configuration_3) > > We now have the decision to either revert the use of Database Rider, or to > use it and accept, and document, the consequence that Junit setup > functionality is not available in those tests. Having a warning in the > Test Control Module documentation would have allowed us to make this > decision earlier. > > In any case I will suggest to the Database Rider author that he put in a > warning in his documentation as I think it is an important point to > mention. > > > Regards, > Gary > > On 20 November 2017 at 12:23, Gerhard Petracek <[email protected]> > wrote: > > > hi gary, > > > > that flag shouldn't be in the documentation at all (to avoid confusion). > > we just kept the possibility to use test-classes as cdi-beans, because it > > was the default behavior prior v1 (before we found the issue with > @Before) > > and some users used it extensively. > > > > regards, > > gerhard > > > > > > > > 2017-11-20 11:14 GMT+01:00 Gary Hodgson <[email protected]>: > > > > > Hi Gerhard, > > > > > > Thanks for confirming that. > > > > > > I couldn't find mention of this in the documentation (perhaps it passed > > me > > > by), perhaps it would be worthwhile adding a sentence to the Test > Control > > > Module for others in the future? > > > > > > All the best, > > > Gary > > > > > > On 19 November 2017 at 23:24, Gerhard Petracek < > > [email protected] > > > > > > > wrote: > > > > > > > hi gary, > > > > > > > > exactly that issue was the reason for the flag and the reason why > it's > > > > false per default. > > > > > > > > regards, > > > > gerhard > > > > > > > > http://www.irian.at > > > > > > > > Your JavaEE powerhouse - > > > > JavaEE Consulting, Development and > > > > Courses in English and German > > > > > > > > Professional Support for Apache > > > > MyFaces, DeltaSpike and OpenWebBeans > > > > > > > > > > > > > > > > 2017-11-19 21:07 GMT+01:00 Gary Hodgson <[email protected]>: > > > > > > > > > Hi > > > > > > > > > > I have a question about using @Before in CdiTestRunner enabled unit > > > > tests. > > > > > > > > > > The following test fails when I set the config property > > > > > deltaspike.testcontrol.use_test_class_as_cdi_bean=true > > > > > > > > > > @RunWith(CdiTestRunner.class) > > > > > public class ATest { > > > > > > > > > > boolean a; > > > > > > > > > > @Before > > > > > public void setup() { > > > > > a = true; > > > > > } > > > > > > > > > > @Test > > > > > public void testA() { > > > > > assertTrue(a); > > > > > } > > > > > } > > > > > > > > > > > > > > > Is this expected behaviour because the test class is processed as a > > CDI > > > > > bean? Or is it a bug? > > > > > > > > > > Cheers, > > > > > Gary > > > > > > > > > > > > > > >
