-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Arquillian test environment #140
base: master
Are you sure you want to change the base?
Conversation
Cool, but I'm sure GF 4 is supported, as I'm using it in some project. It's cool to see all of this works in Wildfly and Hibernate, but I'd rather have tests that "prove" that our production works. I'll need to check it and get back to you :-/ |
Ok, I checked some of my other projects, and I'm just using this:
Don't focus on -3.1, it doesn't mean it requires a gf 3.1 and it works fine with 4.1. I think it's better to use some specifically installed glassfish for tests. It's also faster: it won't start it once per test. And all stuff will work out of the box: jndi properties, auth module, ... Anyway, anything build parameters should be in a maven profile in your settings.xml, so you don't have to specify them each time. I usually create a profile for that that's activated by default, or by some property. |
Use maven properties
Updated. |
Please do use the same database :-) That way, you don't need to populate one. That also means: only one way to create a database, the test one is not different. Those tests won't ever run on production. They will run on a copy of it, from time to time, which is a good thing. |
if (saleCustomerLoyaltyEntry != null) { | ||
removeCustomerLoyaltyAccountingEntry(saleCustomerLoyaltyEntry); | ||
} | ||
} catch (IllegalStateException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever we catch something like this, we can now the Exception type isn't appropriate.
I'll need to work on it too to have a common first test we agree on. |
I set up the Arquillian environment for comptoir-ejb
It is bound to a maven profile 'test'.
I launch the maven test goal with the following settings:
-P test
The plugins in the POM will download a wildfly and start it as the Arquilllian container. I took Wildfly because it looked like the only JEE7 container supported.
The persistence.xml point to the default datasource enabled in the wildfly default config.
The persistence provider is Hibernate, so I had to make some small changes to support it.
I created a StockEntries test to ensure stock entries are correctly updated when sales are open/closed.
The embedded wildfly will bind to port 8080, so it cannot be used when running the test suite.