栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Maven故障安全插件:如何使用集成前和集成后测试阶段

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Maven故障安全插件:如何使用集成前和集成后测试阶段

在常规的内置Maven生命周期(jar,war …)中,

pre-integration-test
post-integration-test
测试阶段未绑定到任何maven插件(即,这些阶段的默认行为是“不执行任何操作”)。如果要为该
integration-test
阶段中执行的测试设置并填充数据库,则需要将执行该工作的Maven插件绑定到这些阶段。

在SQL Maven插件在Maven构建执行SQL脚本。将此插件绑定到的配置

pre/post-integration-phase
非常简单:

在pom.xml文件的

build
>
plugins
部分中,添加sql-maven-plugin

  <plugin>    <groupId>org.prehaus.mojo</groupId>    <artifactId>sql-maven-plugin</artifactId>    <version>1.5</version>    <dependencies>      <!-- include the JDBC driver dependency here -->      <dependency>        <groupId>...</groupId>        <artifactId>...</artifactId>        <version>...</version>      </dependency>    </dependencies>    <!-- common plugin configuration -->    <configuration>      <driver>...</driver>      <url>...</url>      <username>...</username>      <password>...</password>      <!-- other parameters -->    </configuration>    <!-- the executions section binds the phases with some plugin goals and optional additional configuration parameters -->    <executions>      <execution>        <phase>pre-integration-test</phase>        <goals>          <goal>execute</goal>        </goals>        <!-- specific configuration for this execution -->        <configuration>          <!-- Include here the SQL scripts to create the DB, inject some test data -->        </configuration>      </execution>      <execution>        <phase>post-integration-test</phase>        <goals>          <goal>execute</goal>        </goals>        <configuration>          <!-- Include here the SQL scripts to drop the database -->        </configuration>      </execution>      [...]    </executions>  </plugin>

这应该够了吧。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/452962.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号