How to automate the assembly, deployment, and testing of a Java web application?

At the moment, I have a java web project that is automatically created and deployed to JBoss, just copying the ear archive to the dir server (everyone uses Ant).

I need a mechanism that allows not only to automatically deploy the application, but also to check whether the application is installed successfully, and run HttpUnit tests on it.

The problem is how to automatically control the deployment process in order to wait until the deployment is complete and only after this testing. Therefore, I want to create, deploy, run tests in one click (for this I use Cruise Control).

I would appreciate any suggestion to solve the problem.

+3
source share
4 answers

Create a base test class from which all other tests are derived. It must be abstract, so the automatic unit test collector does not try to run it.

In this class, add this code to setUp ():

if (checkIsDeployed) {
    ... run code to verify your app is ready for testing and wait until it is ...
    checkIsDeployed = true;
}

checkIsDeployed must be static.

+1
source

Now you need to start the container and deploy the application from the build script before running the tests, depending on the deployed application. This is a typical need for integration tests, end-to-end / functional tests, ui tests.

, " " /. , , . , , , .

, Cargo. Cargo - Java API / . Java, Ant Maven.

Maven, - "-". ... "pre-integration-test" "post-integration-test". / . Ant, Ant.

, maven, Mavan Jetty Plugin Configuration Guide. , , , , " " " ".

+6

- JBoss Server Ant .

, , JBoss , . , JBoss - JBoss JVM, - . , JBoss.

Cargo. , JBoss. , JBoss Cargo JBoss.

+1

hudson: https://hudson.dev.java.net/, .

I know that hudson can be used to run unit tests, and automatic deployment can be achieved by calling ant.

Charles

0
source

Source: https://habr.com/ru/post/1704562/


All Articles