Previous: Maven implementation of Web application integration test Automation-Test automation (WebTest Maven Plugin)
Before describing how to use the WebTest plug-in to implement Web integration testing in Maven, here's a legacy issue where the Web app is already deployed in the container in service state when performing MAVEN's intergation test. Can the deployment of Web applications be automated? In our company's system, because of the use of WebLogic cluster, wrote their footsteps to achieve deployment, cost a lot of manpower and resources, in fact, Java Web applications have long been the gospel, is a plug-in artifact for automating the installation of containers and deploying applications: Cargo-maven2-plugin, which is compatible with all current mainstream servers such as JBoss, Tomcat, GlassFish, Jetty, and more.
Its configuration is simple, add cargo-maven2-plugin in Build, in order to implement integration test automation, declare the integration test phase before calling Cargo:start launch container and deploy the application, call Cargo:stop close the container after the integration test is finished. The default start container ends at the end of the Maven life cycle, and sometimes, for debugging convenience, you can call Cargo:run to start the container and deploy the app, and then run it through CTRL + C when needed.
In order to implement container start-up and deployment automation, you also need to provide some configuration parameters to plug-ins, here is an example, cargo there are many other features, for reference: Cargo automatic deployment of the official website
<plugin> <groupid>org.codehaus.cargo</gr Oupid> <artifactId>cargo-maven2-plugin</artifactId> <versio N>${project.cargopluginversion}</version> <configuration> <!--definition Container--<container> <!--Co Ntainer Type Jetty/tomcat/weblogic/jboss etc--and <containerid>${project.cargo.contain er}</containerid> <!--Specify the container download path, save the path, unzip the path, and place it in the target directory, which can be automatically erased when clean. <zipUrlInstaller> <url>${project.cargo.container. Url}</url> <downloaddir>${project.build.directory}/${project.cargo.contain Er}/downloads</downloAddir> <extractdir>${project.build.directory}/${project.cargo.container}/extr Acts</extractdir> </zipUrlInstaller> <!--c Argo Log Storage-<log>${project.build.directory}/logs/cargo.log</log> <!--container Log storage--<output>${project.bu Ild.directory}/logs/container.out</output> </container> <!--add container related configuration information-<configuration> <!-- Set deploy home--
Maven implements Web application integration test Automation-Deployment Automation (WebTest Maven Plugin)