Class KnownFailuresList


  • public class KnownFailuresList
    extends java.lang.Object
    Support class to read and process a list of tests and test cases which are known to fail during execution. The intent is to allow better post-run analysis of repetitive test runs, making is easier to find out what has "changed" since the list was made. This class is loosely based on the exclude list, making it easy to interchange the files and tools. File format: Test_URL[Test_Cases] BugID_List The test URL rules are defined elsewhere, but it is critical that the test names do not contain spaces and nothing before the BugID_List has any whitespace. The exact format of the BugID_List must simply conform to being comma separated values, no whitespace or non-printable characters.
    Since:
    4.4
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  KnownFailuresList.Entry
      An entry in the exclude list.
      static class  KnownFailuresList.Fault
      This exception is used to report problems manipulating an exclude list.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String KFL_FILE_VERSION  
      static java.lang.String KFLFILE_EXTN
      The standard extension for KFL files.
    • Constructor Summary

      Constructors 
      Constructor Description
      KnownFailuresList()
      Create a new, empty KFL object.
      KnownFailuresList​(java.io.File f)
      Create an KnownFailuresList from the data contained in a file.
      KnownFailuresList​(java.io.File[] files)
      Create a KnownFailuresList from the data contained in a series of files.
      KnownFailuresList​(java.io.File[] files, boolean strict)
      Create a KnownFailuresList from the data contained in a series of files.
      KnownFailuresList​(java.io.File f, boolean strict)
      Create an KnownFailuresList from the data contained in a file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(KnownFailuresList.Entry e)  
      boolean equals​(java.lang.Object obj)  
      KnownFailuresList.Entry[] find​(java.lang.String url)  
      KnownFailuresList.Entry find​(java.lang.String url, java.lang.String tc)  
      java.util.Iterator<KnownFailuresList.Entry> getIterator​(boolean group)
      Iterate over the contents of the table.
      java.lang.String getTitle()
      Get the title for this exclude list.
      int hashCode()  
      boolean isEmpty()
      Check whether an exclude list has any entries or not.
      static boolean isKflFile​(java.io.File f)
      Test if a file appears to be for an exclude list, by checking the extension.
      boolean isStrictModeEnabled()
      Check whether strict mode is enabled or not.
      boolean listsAllOf​(TestDescription td)
      Test if a specific test is completely excluded according to the table.
      boolean listsAllOf​(java.lang.String url)
      Test if a specific test is completely excluded according to the table.
      boolean listsAnyOf​(TestDescription td)
      Test if a specific test is partially or completely excluded according to the table.
      boolean listsAnyOf​(java.lang.String url)
      Test if a specific test is partially or completely excluded according to the table.
      void merge​(KnownFailuresList other)
      Merge the contents of another exclude list into this one.
      void setStrictModeEnabled​(boolean on)
      Specify whether strict mode is on or not.
      void setTitle​(java.lang.String title)
      Set the title for this exclude list.
      int size()
      Get the number of entries in the table.
      void write​(java.io.File f)
      Write the table out to a file.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • KFLFILE_EXTN

        public static final java.lang.String KFLFILE_EXTN
        The standard extension for KFL files. (".kfl")
        See Also:
        Constant Field Values
      • KFL_FILE_VERSION

        public static final java.lang.String KFL_FILE_VERSION
        See Also:
        Constant Field Values
    • Constructor Detail

      • KnownFailuresList

        public KnownFailuresList()
        Create a new, empty KFL object.
      • KnownFailuresList

        public KnownFailuresList​(java.io.File f)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException,
                                 KnownFailuresList.Fault
        Create an KnownFailuresList from the data contained in a file.
        Parameters:
        f - The file to be read.
        Throws:
        java.io.FileNotFoundException - if the file cannot be found
        java.io.IOException - if any problems occur while reading the file
        KnownFailuresList.Fault - if the data in the file is inconsistent
        See Also:
        KnownFailuresList(File[])
      • KnownFailuresList

        public KnownFailuresList​(java.io.File f,
                                 boolean strict)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException,
                                 KnownFailuresList.Fault
        Create an KnownFailuresList from the data contained in a file.
        Parameters:
        f - The file to be read.
        strict - Indicate if strict data checking rules should be used.
        Throws:
        java.io.FileNotFoundException - if the file cannot be found
        java.io.IOException - if any problems occur while reading the file
        KnownFailuresList.Fault - if the data in the file is inconsistent
        See Also:
        KnownFailuresList(File[]), setStrictModeEnabled(boolean)
      • KnownFailuresList

        public KnownFailuresList​(java.io.File[] files)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException,
                                 KnownFailuresList.Fault
        Create a KnownFailuresList from the data contained in a series of files.
        Parameters:
        files - The file to be read.
        Throws:
        java.io.FileNotFoundException - if any of the files cannot be found
        java.io.IOException - if any problems occur while reading the files.
        KnownFailuresList.Fault - if the data in the files is inconsistent
        See Also:
        KnownFailuresList(File)
      • KnownFailuresList

        public KnownFailuresList​(java.io.File[] files,
                                 boolean strict)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException,
                                 KnownFailuresList.Fault
        Create a KnownFailuresList from the data contained in a series of files.
        Parameters:
        files - The file to be read.
        strict - Indicate if strict data checking rules should be used.
        Throws:
        java.io.FileNotFoundException - if any of the files cannot be found
        java.io.IOException - if any problems occur while reading the files.
        KnownFailuresList.Fault - if the data in the files is inconsistent
        See Also:
        KnownFailuresList(File), setStrictModeEnabled(boolean)
    • Method Detail

      • isKflFile

        public static boolean isKflFile​(java.io.File f)
        Test if a file appears to be for an exclude list, by checking the extension.
        Parameters:
        f - The file to be tested.
        Returns:
        true if the file appears to be a known failures list.
      • setStrictModeEnabled

        public void setStrictModeEnabled​(boolean on)
        Specify whether strict mode is on or not. In strict mode, calls to addEntry may generate an exception in the case of conflicts, such as adding an entry to exclude a specific test case when the entire test is already excluded.
        Parameters:
        on - true if strict mode should be enabled, and false otherwise
        See Also:
        isStrictModeEnabled()
      • isStrictModeEnabled

        public boolean isStrictModeEnabled()
        Check whether strict mode is enabled or not. In strict mode, calls to addEntry may generate an exception in the case of conflicts, such as adding an entry to exclude a specific test case when the entire test is already excluded.
        Returns:
        true if strict mode is enabled, and false otherwise
        See Also:
        setStrictModeEnabled(boolean)
      • getIterator

        public java.util.Iterator<KnownFailuresList.Entry> getIterator​(boolean group)
        Iterate over the contents of the table.
        Parameters:
        group - if true, entries for the same relative URL are grouped together, and if more than one, returned in an array; if false, the iterator always returns separate entries.
        Returns:
        an iterator for the table: the entries are either single instances of @link(Entry) or a mixture of @link(Entry) and @link(Entry)[], depending on the group parameter.
        See Also:
        KnownFailuresList.Entry
      • merge

        public void merge​(KnownFailuresList other)
        Merge the contents of another exclude list into this one. The individual entries are merged; The title of the exclude list being merged is ignored.
        Parameters:
        other - the exclude list to be merged with this one.
      • listsAllOf

        public boolean listsAllOf​(TestDescription td)
        Test if a specific test is completely excluded according to the table. It is completely excluded if there is an entry, and the test case field is null.
        Parameters:
        td - A test description for the test being checked.
        Returns:
        true if the table contains an entry for this test.
      • listsAllOf

        public boolean listsAllOf​(java.lang.String url)
        Test if a specific test is completely excluded according to the table. It is completely excluded if there is an entry, and the test case field is null.
        Parameters:
        url - The test-suite root-relative URL for the test.
        Returns:
        true if the table contains an entry for this test.
      • listsAnyOf

        public boolean listsAnyOf​(TestDescription td)
        Test if a specific test is partially or completely excluded according to the table. It is so excluded if there is any entry in the table for the test.
        Parameters:
        td - A test description for the test being checked.
        Returns:
        true if the table contains an entry for this test.
      • listsAnyOf

        public boolean listsAnyOf​(java.lang.String url)
        Test if a specific test is partially or completely excluded according to the table. It is so excluded if there is any entry in the table for the test.
        Parameters:
        url - The test-suite root-relative URL for the test.
        Returns:
        true if the table contains an entry for this test.
      • isEmpty

        public boolean isEmpty()
        Check whether an exclude list has any entries or not.
        Returns:
        true if this exclude list has no entries
        See Also:
        size()
      • size

        public int size()
        Get the number of entries in the table.
        Returns:
        the number of entries in the table
        See Also:
        isEmpty()
      • getTitle

        public java.lang.String getTitle()
        Get the title for this exclude list.
        Returns:
        the title for this exclude list
        See Also:
        setTitle(java.lang.String)
      • setTitle

        public void setTitle​(java.lang.String title)
        Set the title for this exclude list.
        Parameters:
        title - the title for this exclude list
        See Also:
        getTitle()
      • write

        public void write​(java.io.File f)
                   throws java.io.IOException
        Write the table out to a file.
        Parameters:
        f - The file to which the table should be written.
        Throws:
        java.io.IOException - is thrown if any problems occur while the file is being written.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - - object to compare
        Returns:
        returns true if two entry tables are equal
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object