0

我已经写信给第谷的 gitHub,但似乎我做错了什么我不会得到答案。我尝试在 tycho-surefire 报告中更改 eclipse rcp 应用程序测试中的测试名称。例如简单的测试类(它的工作方式与我的真实测试套件完全相同)

package org.jkiss.dbeaver.swtbottest.tests;

import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
@DisplayName("Custom name")
public class MySuitTests {

    @Test
    @DisplayName("My test name")
    public void uglyNameTest(){
        System.out.println("Do something");
        SWTBot bot = new SWTBot();
        bot.sleep(2000);
    }

}

(已经尝试将Test注释更改为org.junit.Test,它没有帮助)

.pom 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <groupId>...</groupId>
    <artifactId>auto-test.ui</artifactId>
    <packaging>pom</packaging>

    <parent>
        <groupId>...</groupId>
        <artifactId>auto-test</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../</relativePath>
    </parent>

    <modules>
        <module>swtbot-simple</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.7.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>2.4.0</version>
                <configuration>
                    <useUIHarness>true</useUIHarness>
                    <useUIThread>false</useUIThread>
                    <product>ui.app.standalone.product</product>
                    <application>ui.app.standalone.standalone</application>
                    <testRuntime>default</testRuntime>
                    <bundleStartLevel>
                        <bundle>
                            <id>org.eclipse.osgi</id>
                            <level>-1</level>
                            <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                            <id>org.apache.felix.scr</id>
                            <level>2</level>
                            <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                            <id>org.eclipse.core.runtime</id>
                            <level>4</level>
                            <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                            <id>org.eclipse.equinox.common</id>
                            <level>2</level>
                            <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                            <id>org.eclipse.equinox.event</id>
                            <level>2</level>
                            <autoStart>true</autoStart>
                        </bundle>
                    </bundleStartLevel>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>4.0.0</version>
                <configuration>
                    <dependency-resolution>
                        <extraRequirements>
                            <requirement>
                                <type>eclipse-feature</type>
                                <id>org.eclipse.rcp</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                            <requirement>
                                <type>eclipse-feature</type>
                                <id>org.eclipse.pde</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                        </extraRequirements>
                    </dependency-resolution>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

它会生成这样的报告:

<?xml version="1.0" encoding="UTF-8"?>

-<testsuite failures="0" skipped="0" errors="0" tests="1" time="5.18" name="org.tests.MyTests" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties/>
<testcase time="5.153" name="uglyTestName" classname="org.test.tests.MyTests"/>
</testsuite>

有人告诉我 DisplayName 应该与 tycho-surefire 一起使用,要么我有错误,要么我没有在 pom.xml 中连接某些东西。我找不到这个案例的明确示例或文档,所以我需要帮助

4

0 回答 0