[testng-dev] Is there any way to integrate TestNG with CDI?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[testng-dev] Is there any way to integrate TestNG with CDI?

roytmana
Hi,

I want to be able to test my JPA persistence layer and some code that is based on it. I am using Weld 3.0 and Deltaspike to integrate JPA and @Transactional behavior
I managed to statr/stop container, inject any dependencies into a test instances via TestNG annotated methods - it works. But it is lame because I could not find a way to use CDI to actually instantiate test as beans so TestNG is in charge of test instantiation and creates it without the benefit of CDI and thus @Transactional is not working. Is there any way to customize TesNG to delegate test instantiation to CDI? I saw Guice integration (did not explore it) but nothing about CDI 

Or any other way to integrate transactional. I guess I could use one of the TestNG listeners to star/stop transactions for transitionally annotated test methods but I was hoping for a more complete solution where TestNG lets me intercept test instantiation before dong all of its things with it and invoking its methods

Thanks 
Alex  

--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[testng-dev] Re: Is there any way to integrate TestNG with CDI?

Julien Herr
Hi,

TestNG doesn't support CDI out of the box.

But some third parties like Aquillian or TomEE integrate JavaEE/CDI with TestNG.
Maybe you should a look to them.

Julien

Le jeudi 6 juillet 2017 09:10:05 UTC+2, [hidden email] a écrit :
Hi,

I want to be able to test my JPA persistence layer and some code that is based on it. I am using Weld 3.0 and Deltaspike to integrate JPA and @Transactional behavior
I managed to statr/stop container, inject any dependencies into a test instances via TestNG annotated methods - it works. But it is lame because I could not find a way to use CDI to actually instantiate test as beans so TestNG is in charge of test instantiation and creates it without the benefit of CDI and thus @Transactional is not working. Is there any way to customize TesNG to delegate test instantiation to CDI? I saw Guice integration (did not explore it) but nothing about CDI 

Or any other way to integrate transactional. I guess I could use one of the TestNG listeners to star/stop transactions for transitionally annotated test methods but I was hoping for a more complete solution where TestNG lets me intercept test instantiation before dong all of its things with it and invoking its methods

Thanks 
Alex  

--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.
Loading...