maven配置testng

TestNG Maven surefire plugin configurations let us define which tests to execute when we run the maven build. When we have a large project with many test cases, then it comes handy to configure only specific test suites for execution.

TestNG Maven surefire插件配置使我们可以定义运行maven构建时要执行的测试。 当我们有一个包含许多测试用例的大型项目时,仅配置用于执行的特定测试套件就很方便。

TestNG Maven项目 (TestNG Maven Project)

During the series of TestNG Tutorials here, I have created a lot of test classes and TestNG XML suite files. Below image shows the current project structure and all the test classes it has.

在这里的TestNG教程系列中,我创建了许多测试类和TestNG XML套件文件。 下图显示了当前的项目结构及其所有测试类。

Now when I run a maven build, it scans the project and executes all the test classes. So project build takes a lot of time. If I am interested in specific tests only, chances are that its logging gets lost in all the noise created by other tests.

现在,当我运行Maven构建时,它将扫描项目并执行所有测试类。 因此,项目构建需要很多时间。 如果我仅对特定测试感兴趣,则很可能它的日志记录会丢失于其他测试所产生的所有噪声中。

Maven Surefire插件 (Maven Surefire Plugin)

Maven surefire plugin is used to run the project tests. It also allows us to configure which XML suites to execute when we build our project. Below configuration will tell maven surefire plugin to execute only testng.xml and test_parameters.xml test suite files.

Maven surefire插件用于运行项目测试。 它还允许我们配置在构建项目时要执行的XML套件。 下面的配置将告诉Maven testng.xml插件仅执行testng.xmltest_parameters.xml测试套件文件。

<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.21.0</version><configuration><!-- TestNG Suite XML files list for test execution --><suiteXmlFiles><suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile><suiteXmlFile>src/test/resources/test_parameters.xml</suiteXmlFile></suiteXmlFiles></configuration></plugin></plugins>
</build>

Now when we perform maven build by running mvn clean install or mvn test commands, we get a clean output for our tests.

现在,当我们通过运行mvn clean installmvn test命令执行maven构建时,我们将获得mvn test的干净输出。

That’s all for configuring maven-surefire-plugin to execute only specific TestNG XML suite files.

这就是配置maven-surefire-plugin仅执行特定的TestNG XML套件文件的全部。

GitHub Repository.GitHub Repository下载示例代码。

翻译自: https://www.journaldev.com/21326/testng-maven-surefire-plugin-configurations

maven配置testng

maven配置testng_TestNG Maven Surefire插件配置相关推荐

  1. Maven 配置文件 POM 的常用插件配置代码

    Maven 配置文件 POM 的常用插件配置代码 普通 将 Maven 多模块依赖集成打进一个 JAR 包(方法 1) 将 Maven 多模块依赖集成打进一个 JAR 包(方法 2) 生成单入口类 J ...

  2. maven配置_eclipse创建maven_maven插件配置

    为什么80%的码农都做不了架构师?>>>    最近项目开发中需要使用maven.Maven这个东西是我2年前自学的.这2年之中基本没有使用过.现在项目需要,只有重新来一遍回锅肉.重 ...

  3. Maven 配置文件 POM 的常用依赖配置代码

    Maven 配置文件 POM 的常用依赖配置代码 Lombok 测试 Junit 5 日志 Log4j2 & SLF4J & Lombok Spring Bean Spring Boo ...

  4. vim学习、各类插件配置与安装

    vim学习.各类插件配置与安装 vim 插件 配置 1. vim学习 vim基础学习:根据网上流行基础文章<简明Vim练级攻略>,进阶书籍<vim实用技巧>.注:进阶书籍可以在 ...

  5. maven配置testng_TestNG和Maven配置指南

    maven配置testng 为了有用,自动测试应该运行得非常快. 否则,将不会在开发期间经常运行,甚至在开发人员工作站上的默认配置中将被忽略. 最简单的规则是只编写小型单元测试,该测试将模拟给定类的邻 ...

  6. Maven(插件配置和生命周期的绑定)

    1.这篇文章很好,介绍的maven插件的. 2.maven的source插件为例,可以把源代码打成包. Goals Overview就可以查看该插件下面所有的目标. 这里我们要使用的是source:j ...

  7. 如何解决Spring Data Maven构建的“生命周期配置未涵盖的插件执行”

    我正在尝试使用Spring Data和Neo4j . 我首先尝试遵循主站点链接的本指南 . 特别是,我的pom.xml基于" Hello,World!". 示例文件 . 这是导致问 ...

  8. jenkins的安装配置,插件配置,安装插件,配置maven,jdk路径,配置安装插件,项目配置,自动构建配置

    1.下载jenkins,下载地址: https://jenkins.io/ 2.运行命令,启动jenkins 将jenkins上传到:/home/tuzq/software 安装JDK,maven ( ...

  9. 1.Maven+SpringMVC+Eclipse软件安装配置,Maven报插件错误,Eclipse总是卡死的解决办法,导入一个maven工程后 一直显示importing maven project

     使用Maven+SpringMVC+Eclipse软件安装配置过程中的问题: 1.Eclipse总是卡死的解决办法: 一:内存不足所以会卡死,配置一下eclipse.ini修改这几个值就好了-X ...

最新文章

  1. InetAddress类和InetSocketAddress的使用
  2. AA065VD时序的确定
  3. 多媒体(1):MCI接口编程
  4. python离散余弦变换_在python3下使用OpenCV做离散余弦变换DCT及其反变换IDCT
  5. python综合练习1-- 用户登录
  6. 微软将结束对Windows Vista系统的扩展支持
  7. 一个标签的72变,打造一个纯CSS图标库
  8. Spring学习总结(26)——Spring事务原理详解
  9. oracle date 截取年月,在Oracle中,可用于提取日期时间类型特定部分(如年、月、日、时、分、秒)的函数有那些...
  10. 个股解析软件排名推荐,股票行情分析软件排名
  11. javascript XMLHttpRequest实现下载文件
  12. DevOps定义基础入门及历史
  13. TouchDesigner学习 全屏输出
  14. 设计模式-外观模式(家庭影院你值得拥有)
  15. juniper认证(JNCIA,JNCIS,JNCIP,JNCIE)介绍
  16. Metro 风格页面设计
  17. Prometheus - 普罗米修斯 - 日志监控mtail尝试
  18. 【板栗糖GIS】工作疑难—win11如何解压z01分解卷压缩包
  19. 读小说赚钱吗?这个年入百万
  20. linux与RMB的关系,linux mb()/rmb()/wmb()

热门文章

  1. 在 Visual Studio 2013 中使用 JavaScript 的 IntelliSense
  2. [转载] Python Web开发最难懂的WSGI协议,到底包含哪些内容? WSGI服务器种类和性能对比
  3. [转载] 20个常用Python库及200个第三方库
  4. [转载] python 超高精度除法_Python十进制-除法,舍入,精度
  5. UIImageView contentModel
  6. 二十六. Python基础(26)--类的内置特殊属性和方法
  7. delphi操作xml学习笔记 之一 入门必读
  8. 当产品部署出现问题时
  9. 【★原创★】夜晚,不要让电白白流失!
  10. VideoMatch: Matching based Video Object Segmentation