arquillian / continuous-enterprise-development

Testable Solutions for Modern Applications
http://continuousdev.org/
116 stars 150 forks source link

Introductory example in Chapter 03: Does it really work? #113

Open robertpanzer opened 10 years ago

robertpanzer commented 10 years ago

The introductory Arquillian example in Chapter 03 uses a remote JBoss container. The test case deploys the war file built from the main java resources that probably do not contain the test case:

[source,java]

@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.createFromZipFile(WebArchive.class, new File(
            "target/feedback.war"));
}

As the test case assumes to be running in the container I guess that the test case will not run due to the missing class in the Deployment.

Or is there something I have overseen?

Kind regards, Robert

ALRubinger commented 10 years ago

Arquillian will slyly add the test case into the WebArchive before it's deployed; you'll never really see us adding the test case itself (or its dependencies) in manually. :)

robertpanzer commented 10 years ago

OK, you're right. Just reproduced it: It works when testing a WAR, the test class is automatically added to WEB-INF/classes. But it is not added to an EAR. (That's what I am always working on, so that's why this made me wonder)

robertpanzer commented 10 years ago

@ALRubinger At least in chapter 05 the test class is added to the deployment ;-)

public static WebArchive deploy() {
    return ShrinkWrap.create(WebArchive.class)
        .addAsLibraries(
            ConferenceDeployments.conference().addClasses(
              ConferenceTestCase.class,

Maybe it's worth spending a note on this.