Spring 如何通过梯度测试任务执行测试方法?

Spring 如何通过梯度测试任务执行测试方法?,spring,spring-boot,testng,build.gradle,Spring,Spring Boot,Testng,Build.gradle,当我以testNG的形式运行testing.xml时,它适合正常运行,但在运行时 渐变测试任务它不执行测试 testing.xml 有人能帮我执行gradle测试任务吗 作为一个选项,您可以在测试任务中直接在gradle中生成xml,它在我们的项目中运行良好 useTestNG() { suiteXmlBuilder().suite(name: 'Default suite') { test(name : 'test') { classes('')

当我以testNG的形式运行testing.xml时,它适合正常运行,但在运行时 渐变测试任务它不执行测试

testing.xml

有人能帮我执行gradle测试任务吗


作为一个选项,您可以在测试任务中直接在gradle中生成xml,它在我们的项目中运行良好

useTestNG() {
    suiteXmlBuilder().suite(name: 'Default suite') {
        test(name : 'test') {
            classes('') {
                'class'(name: 'com.example.EmpBusinessLogicTest')
            }
        }
    }
}
要执行此测试任务(例如与Jenkins一起),您需要向其传递系统属性:

systemProperties System.getProperties()
systemProperty 'user.dir', project.projectDir
useTestNG() {
    suiteXmlBuilder().suite(name: 'Default suite') {
        test(name : 'test') {
            classes('') {
                'class'(name: 'com.example.EmpBusinessLogicTest')
            }
        }
    }
}
systemProperties System.getProperties()
systemProperty 'user.dir', project.projectDir