package com.test.api.junit;
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.DisplayNameGenerator.*;
@DisplayNameGeneration(DisplayNameGenerator.Standard.class)
//@TestMethodOrder(MethodOrderer.OrderAnnotation.class)// 排序结合order注解使用
//@TestMethodOrder(MethodOrderer.DisplayName.class)// 排序结合displayname注解使用
//@TestMethodOrder(MethodOrderer.MethodName.class)//方法名称使用排序
@TestMethodOrder(MethodOrderer.Alphanumeric.class)//根据字母和数字排序
public class canshuhua {
@ParameterizedTest
@ValueSource(strings = {"1","2","3"})
//@Order(2)
public void test1(String status)
{
System.out.println(status);
}
@RepeatedTest(3)//多次执行
public void test5(){
System.out.println("test5");
}
@ParameterizedTest
@CsvSource(value = {"1,2,3","4,5,6"})
//@Order(1)
// @DisplayName("1")
public void test2(String status,String status2,String status3)
{
System.out.println(status);
System.out.println(status2);
System.out.println(status3);
}
@ParameterizedTest
@CsvSource(value = {"1-3","4-6"},delimiter = '-')
//@Order(4)
public void test3(String status,String status2)
{
System.out.println(status+status2);
}
@ParameterizedTest
// @CsvFileSource(resources = "/data.csv")
@CsvFileSource(resources = "/data2.csv",delimiter = '-')
//@Order(3)
public void test4(String status,String status2)
{
System.out.println(status+status2);
}
}