Class TestName

  • All Implemented Interfaces:
    Comparable<TestName>

    public class TestName
    extends Object
    implements Comparable<TestName>
    Represents a test name with suite prefix. If test name matches the following format:
     <package name>[.:]<class name>[.:]<test method name>(<additional parameters for data-driven tests>)
    then additional parameters are available:
    • <package name> - name of the package, does not contain spaces
    • <class name> - test class name, does not contain spaces
    • <test method name> - test method name, does not contain spaces
    • <additional parameters for data-driven tests> - may contain any characters

    Some suite: another: jetbrains.BuildServer.Class.test(params) Separator is SUITE_SEPARATOR ': '

    NOTE: If the reported test name doesn't match the format above, TC will not be able to parse it and the parts (package name, class name, method name) will remain unset.

    • Constructor Detail

      • TestName

        public TestName​(@NotNull
                        String testName)
    • Method Detail

      • getGroupName

        @NotNull
        public TestGroupName getGroupName()
        Returns an object which describes packaging of this test (namely, full suite, package, class)
        Since:
        4.5
      • isJavaLikeTestName

        public boolean isJavaLikeTestName()
        Returns true if test name conforms the specified format.
      • getTestClass

        public String getTestClass()
        For java-like tests returns full class name of the test. For non java-like tests returns empty string.
        Returns:
        empty string or full class name of the test (including package name).
      • getShortName

        @NotNull
        public String getShortName()
        Returns test name with class name
      • getPrefixWithSeparator

        @NotNull
        public String getPrefixWithSeparator()
        Return prefix, which includes suite name and package name. Suite name ends with separator ': '. Examples: 'suite name: jetbrains.buildserver' , 'jetbrains.buildserver', 'suite: name: '
      • getPrefix

        @NotNull
        public String getPrefix()
        Returns test prefix, which includes optional suite name and optional package of the test
      • getSuite

        @NotNull
        public String getSuite()
        Returns test suite, which ends with ': ' if suite is presented. Returns empty string if not available
        See Also:
        getPrefixWithSeparator()
      • getSuiteWithoutSeparator

        @NotNull
        public String getSuiteWithoutSeparator()
        Returns test suite or empty string if not available.
        Since:
        2021.1
        See Also:
        getSuite()
      • getPackageName

        @NotNull
        public String getPackageName()
        Returns the test package name.
        Returns:
        test package, or empty string if it is not available
      • hasPackage

        public boolean hasPackage()
        Returns true if this test has non-empty package name
      • getClassName

        @NotNull
        public String getClassName()
        Returns test case class name or empty string
      • getTestMethodName

        @NotNull
        public String getTestMethodName()
        Returns name of the test method or empty string
      • getParameters

        @NotNull
        public String getParameters()
        Returns additional test parameters specified in test name, or empty string for no parameters
      • getNameWithoutParameters

        @NotNull
        public String getNameWithoutParameters()
        Returns test name with package and class but without parameters
      • equalsByNameWithoutParameters

        public boolean equalsByNameWithoutParameters​(@NotNull
                                                     TestName that)
        Parameters:
        that - another test name
        Returns:
        true, iff "getNameWithoutParameters().equals(that.getNameWithoutParameters())"
      • getNameWithoutSuite

        @NotNull
        public String getNameWithoutSuite()
        Returns test name with package, class and parameters
        Since:
        7.1
      • getTestNameWithParameters

        public String getTestNameWithParameters()
        Returns test name with parameters without class and other parts
      • getAsString

        @NotNull
        public String getAsString()
        Returns full test name string as it was reported by the test runner
      • getTestNameWithoutPrefix

        @NotNull
        public String getTestNameWithoutPrefix()
        Returns full test name, but without prefix
        See Also:
        getPrefixWithSeparator()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object