JBoss Community

Re: getting started unit testing - embedded JBoss AS 7?

created by jaikiran pai in Beginner's Corner - View the full discussion

Matthew Cornell wrote:

 

Thank you - I'm still working on the terminology. I'm using "embedded" to mean starting a Java EE server in the same JVM as the tests then shutting it down when they're through. I understand I don't need a full blown container for unit testing (which I can do with mocks, and with properly-designed code), but I do need it for integration testing.

Okay. That's what typically "embedded" means. Arquillian has 3 server integration types, "managed" (start/stop server as a JVM process), "embedded" (start/stop server within the same process that triggers the JUnit test), "remote" (join a running instance of server). AS7 integration for Arquillian does not have the "embedded" mode. But the use case you mention - running the tests in the same JVM as the server can still be achieved via the others 2 modes too. In fact, when you run an Arquillian test, the Arquillian infrastructure deploys the deployment to the server and depending on the "run mode" the test is either run in the same JVM process as the server or in a separate JVM as the client. By default, the tests are run on the server JVM (from your description that's what you want). If the test uses a @RunAsClient annotation for the test (the arquillian guides have more info about this) then the test is run as a remote client and does not run on the server JVM. I believe, that should make this a bit clear. If you still have more questions, feel free to ask.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community