zoukankan      html  css  js  c++  java
  • maven使用杂记

    maven test使用记录

    运行指定的测试类:
        >mvn test -Dtest=[ClassName]
    运行测试类中指定的方法:(这个需要maven-surefire-plugin:2.7.3以上版本才能支持)
        >mvn test -Dtest=[ClassName]#[MethodName]
        [MethodName]为要运行的方法名,支持*通配符,范例:
       1) >mvn test -Dtest=MyClassTest#test1
       2) >mvn test -Dtest=MyClassTest#*test*
    maven传递参数给testng
    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <suiteXmlFiles>
                            <suiteXmlFile>JenkinsTestng.xml</suiteXmlFile>
                        </suiteXmlFiles>
                        <systemPropertyVariables>
                            <testEnvironment>${testClass}</testEnvironment>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
    <suite name="Suite">
        <listeners>
            <listener class-name="com.yinting.core.Test.TestngListener"></listener>
        </listeners>
        <parameter name="testClass" value="${testClass}"/>
        <test name="Test">
            <classes>
                <class name="com.nonobank.jenkins.service.ParameterTest" />
            </classes>
        </test> <!-- Test -->
    </suite> <!-- Suite -->
    public class ParameterTest {
        @Parameters({ "testClass" })
        @Test
        public void test(String testClass) {
            System.out.println(testClass);
            System.out.println("这是测试页面!");
        }
    }

    该功能可集合Jenkins进行自动化配置执行。

  • 相关阅读:
    Python脚本抓取京东手机的配置信息
    Python中的Pandas模块
    Python中的Pandas模块
    XML和JSON数据格式
    XML和JSON数据格式
    Linux运维比较常用的一些脚本
    Linux运维比较常用的一些脚本
    Keepalived高可用集群
    Keepalived高可用集群
    Linux中正则表达式和字符串的查询、替换(tr/diff/wc/find)
  • 原文地址:https://www.cnblogs.com/swordyt/p/7519663.html
Copyright © 2011-2022 走看看