java test code
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
public class test {
@ParameterizedTest
@MethodSource("userGenerator")
void testFail1(String name,String pw) {
Assertions.assertEquals(name,pw);
}
public static Stream<Arguments> userGenerator(){
return Stream.of(Arguments.of("15138493452", "hlf2016"));
}
}
public class TestListener implements TestExecutionListener {
/*
* ... ...
*/
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
}
if ("SUCCESSFUL".equals(testExecutionResult.getStatus().name())) {
// testExecutionResult.getStatus().name() = "SUCCESSFUL"
}
}
调试截图