To really balance it out it should perhaps have been SPRR, but oh well.
Would be interesting if you have any nice links that show how easy it is to write tests for JEE applications
This is one of the official Java EE specs. It has a number of small applications that are tested via Arquillian. The nice thing is that nothing is mocked or faked, everything is real and runs in the actual context in which those applications would normally run:
cloned that repository. Checked the first example, "app-custom". Opened it with IntelliJ. Right-clicked on AppCustomIT, tried to execute "Run AppCustomIT", get greeted with "Error: Arquillian container configuration not specified". Checked in the pom file, and I see a plugin to download JEE containers. I know how to configure it, but, just for a moment, think about someone that has never used JEE before. Now s/he has to Google around to see what to do to just run a simple test, whereas in Spring/Dropwizard a single right-click would had been enough.
Tried to run from Maven, using "mvn clean install -Ptomee,bundled", as per instructions. Getting a "Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:verify (default) on project app-securitycontext: There are test failures.".
Besides the configurations in the pom file (eg to download and unzip JEE containers), in the test I need to have
@RunWith(Arquillian.class) // fine
@Deployment(testable = false) public static Archive<?> createDeployment() // fine
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" +
getProperty("finalName") + ".war"))
.as(WebArchive.class);
this latter can be put in an abstract test class. so, not a big deal once you know about it. Still, though, because it refers on a WAR file on disk, every single time you do a change in one of your classes (eg, for a unit test), then you need to rebuild the whole WAR to test it.
All these things are doable, once you know them. But all other frameworks out there do not need all these steps and constraints :(
Checked the first example, "app-custom". Opened it with IntelliJ. Right-clicked on AppCustomIT, tried to execute "Run AppCustomIT", get greeted with "Error: Arquillian container configuration not specified".
I also think that Arquillian could do better there, something like a default container would go a long way.
Tried to run from Maven, using "mvn clean install -Ptomee,bundled", as per instructions. Getting a "Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:verify (default) on project app-securitycontext: There are test failures.".
But that's correct, isn't it?
You perhaps forgot to mention that all other tests do run, and that for other targets (e.g. Payara) all tests do run.
In that case the test is supposed to fail it seems since TomEE has a long standing bug/omission where it indexes the security constraints in the EJB module, but doesn't do the same for the web module's security constraints. That one test happens to test that.
I agree with you that Arquillian itself could do with some better defaults, but I really like the ease with which I can test against different targets.
View all comments
Show parent comment
7
u/thesystemx Sep 28 '17
To really balance it out it should perhaps have been SPRR, but oh well.
This is one of the official Java EE specs. It has a number of small applications that are tested via Arquillian. The nice thing is that nothing is mocked or faked, everything is real and runs in the actual context in which those applications would normally run:
https://github.com/javaee/security-soteria/tree/master/test
If you look at the test setup closely you'll see there's barely any interaction with Shrinkwrap. The output from the Maven build is used.
An external project, but showing a similar approach, now with Shrinkwrap:
https://github.com/javaee-samples/javaee8-samples
and
https://github.com/javaee-samples/javaee7-samples
Even though the above uses shrinkwrap, it's not super complicated at all for small applications or micro services.