Class Publish


  • public final class Publish
    extends java.lang.Object
    Class for helper methods to collect and tranform TPT test result.
    Author:
    jkuhnert, PikeTec GmbH
    • Constructor Summary

      Constructors 
      Constructor Description
      Publish()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void find​(FilePath rootdir, java.lang.String pattern, java.util.Collection<FilePath> files)
      find all files in directory "root" with file name "pattern" and stores them in collection "files"
      static java.util.List<Testcase> getTestcases​(FilePath testDataDir, TptLogger logger)
      Collects recursively all test cases by searching for "testcase_information.xml" files in "rootdir".
      static int publishJUnitResults​(JenkinsConfiguration jenkinsConfig, FilePath testDataDir, FilePath jUnitOutputDir, TptLogger logger, com.piketec.jenkins.plugins.tpt.TptLog.LogLevel logLevel)
      Publish the Junits results, it creates an XML file and write the results on it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Publish

        public Publish()
    • Method Detail

      • publishJUnitResults

        public static int publishJUnitResults​(JenkinsConfiguration jenkinsConfig,
                                              FilePath testDataDir,
                                              FilePath jUnitOutputDir,
                                              TptLogger logger,
                                              com.piketec.jenkins.plugins.tpt.TptLog.LogLevel logLevel)
                                       throws java.io.IOException,
                                              java.lang.InterruptedException
        Publish the Junits results, it creates an XML file and write the results on it.
        Parameters:
        jenkinsConfig - The configuration to which the TPT test resuklt should be tranformed to JUnit
        testDataDir - The directory where TPT test data should be searched
        jUnitOutputDir - The directory where the transformed results should be written to.
        logger - to display the information
        logLevel - the threshold for the severity of the log messages
        Returns:
        the number of testcases .
        Throws:
        java.io.IOException - if an error occured while parsing TPT test data or writing the JUnit xml files
        java.lang.InterruptedException - If the job was interrupted
      • getTestcases

        public static java.util.List<Testcase> getTestcases​(FilePath testDataDir,
                                                            TptLogger logger)
                                                     throws java.io.IOException,
                                                            java.lang.InterruptedException
        Collects recursively all test cases by searching for "testcase_information.xml" files in "rootdir". If a file could not be loaded, an error message will be printed.
        Parameters:
        testDataDir - The directory where TPT test data should be searched
        logger - to display the information
        Returns:
        The list of parsed TPT test cases
        Throws:
        java.io.IOException - If an error occured while parsing TPT test data
        java.lang.InterruptedException - If the job was interrupted
      • find

        public static void find​(FilePath rootdir,
                                java.lang.String pattern,
                                java.util.Collection<FilePath> files)
                         throws java.io.IOException,
                                java.lang.InterruptedException
        find all files in directory "root" with file name "pattern" and stores them in collection "files"
        Parameters:
        rootdir - The directory that should be searched
        pattern - The file name that has to be found.
        files - The collection to pupulate
        Throws:
        java.io.IOException - If an error occured while parsing TPT test data
        java.lang.InterruptedException - If the job was interrupted