You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by st...@bundesbank.de on 2016/07/01 12:11:23 UTC

Boot External Containers in TestNg Tests


Hello,

I want to have some tests where a cdi container is needed and some JSF
beans are involved (especcially the beans where a FacesContext is used). So
I need to boot an external JSF container beside the CDI container.

I found in the documentation of the Test-Control module to write these
properties
        org.apache.deltaspike.testcontrol.impl.jsf.MockedJsf2TestContainer

org.apache.deltaspike.testcontrol.impl.jsf.MockedJsfTestContainerAdapter
        org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerAdapter

org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerPerTestMethodAdapter

as content
to /META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer


Unfortunately I cannot get it to work. I had a look at Gerhards blog where
an example is mentioned. But there JUnit and its Annotation @RunWith
(CdiTestRunner.class) is used.

In my project I have to use TestNg. As far as I know there is no
configuration to use this CDITestRunner-class for TestNg. I start the cdi
test container manually via the container-control-module.

So is there some possiblity to test with a mocked JSF container using
TestNg?

Kind regards,
Steve

--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail oder von Teilen dieser Mail ist nicht gestattet.

Wir haben alle verkehrsüblichen Maßnahmen unternommen, um das Risiko der
Verbreitung virenbefallener Software oder E-Mails zu minimieren, dennoch
raten wir Ihnen, Ihre eigenen Virenkontrollen auf alle Anhänge an dieser
Nachricht durchzuführen. Wir schließen außer für den Fall von Vorsatz oder
grober Fahrlässigkeit die Haftung für jeglichen Verlust oder Schäden durch
virenbefallene Software oder E-Mails aus.

Jede von der Bank versendete E-Mail ist sorgfältig erstellt worden, dennoch
schließen wir die rechtliche Verbindlichkeit aus; sie kann nicht zu einer
irgendwie gearteten Verpflichtung zu Lasten der Bank ausgelegt werden.
______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of  the material in this
e-mail or of parts hereof is strictly forbidden.

We have taken precautions to minimize the risk of transmitting software
viruses but nevertheless advise you to carry out your own virus checks on
any attachment of this message. We accept no liability for loss or damage
caused by software viruses except in case of gross negligence or willful
behaviour.

Any e-mail messages from the Bank are sent in good faith, but shall not be
binding or construed as constituting any kind of obligation on the part of
the Bank.

Re: Boot External Containers in TestNg Tests

Posted by Gerhard Petracek <ge...@gmail.com>.
hi steve,

that's correct - (currently) we don't support testng.
if you integrate the test-support manually (for testng), you have to
integrate the external-container-spi as well.
(load the config on your own or via ServiceUtils#loadServiceImplementations
-> store the instance/s and call the external-container-methods as you need
them.)

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

2016-07-01 14:11 GMT+02:00 <st...@bundesbank.de>:

>
>
> Hello,
>
> I want to have some tests where a cdi container is needed and some JSF
> beans are involved (especcially the beans where a FacesContext is used). So
> I need to boot an external JSF container beside the CDI container.
>
> I found in the documentation of the Test-Control module to write these
> properties
>         org.apache.deltaspike.testcontrol.impl.jsf.MockedJsf2TestContainer
>
> org.apache.deltaspike.testcontrol.impl.jsf.MockedJsfTestContainerAdapter
>         org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerAdapter
>
>
> org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerPerTestMethodAdapter
>
> as content
> to
> /META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer
>
>
> Unfortunately I cannot get it to work. I had a look at Gerhards blog where
> an example is mentioned. But there JUnit and its Annotation @RunWith
> (CdiTestRunner.class) is used.
>
> In my project I have to use TestNg. As far as I know there is no
> configuration to use this CDITestRunner-class for TestNg. I start the cdi
> test container manually via the container-control-module.
>
> So is there some possiblity to test with a mocked JSF container using
> TestNg?
>
> Kind regards,
> Steve
>
> --
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail oder von Teilen dieser Mail ist nicht gestattet.
>
> Wir haben alle verkehrsüblichen Maßnahmen unternommen, um das Risiko der
> Verbreitung virenbefallener Software oder E-Mails zu minimieren, dennoch
> raten wir Ihnen, Ihre eigenen Virenkontrollen auf alle Anhänge an dieser
> Nachricht durchzuführen. Wir schließen außer für den Fall von Vorsatz oder
> grober Fahrlässigkeit die Haftung für jeglichen Verlust oder Schäden durch
> virenbefallene Software oder E-Mails aus.
>
> Jede von der Bank versendete E-Mail ist sorgfältig erstellt worden, dennoch
> schließen wir die rechtliche Verbindlichkeit aus; sie kann nicht zu einer
> irgendwie gearteten Verpflichtung zu Lasten der Bank ausgelegt werden.
> ______________________________________________________________________
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorised copying, disclosure or distribution of  the material in this
> e-mail or of parts hereof is strictly forbidden.
>
> We have taken precautions to minimize the risk of transmitting software
> viruses but nevertheless advise you to carry out your own virus checks on
> any attachment of this message. We accept no liability for loss or damage
> caused by software viruses except in case of gross negligence or willful
> behaviour.
>
> Any e-mail messages from the Bank are sent in good faith, but shall not be
> binding or construed as constituting any kind of obligation on the part of
> the Bank.