Class AcceptanceTestTask


  • public class AcceptanceTestTask
    extends org.apache.tools.ant.Task
    A Task to run acceptance tests, configurable from a file.
    Author:
    Kim Rutherford
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TRAC_TICKET_URL_PREFIX
      Prefix of the ticket pages in Trac.
      • Fields inherited from class org.apache.tools.ant.Task

        description, location, target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        project
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      static java.lang.String hyperLinkNote​(java.lang.String note)
      Return a hyperlinked version of the given note.
      protected void processResults​(java.util.List<org.intermine.task.AcceptanceTestResult> testResults, java.io.PrintWriter pw)
      Write a formatted HTML summary of the given AcceptanceTestResult objects to the PrintWriter.
      static org.intermine.task.AcceptanceTest readOneTestConfig​(java.io.LineNumberReader configReader)
      Read and return one AcceptanceTest object from the given Reader.
      protected java.util.List<org.intermine.task.AcceptanceTestResult> runAllTests​(Database db, java.io.LineNumberReader configReader)
      Run all the tests and return a List of AcceptanceTestResult objects.
      void setConfigFile​(java.io.File configFile)
      Set the File to read configuration from
      void setDatabase​(java.lang.String database)
      Set the database alias
      void setOutputFile​(java.io.File outputFile)
      Set the File to write output to
      • Methods inherited from class org.apache.tools.ant.Task

        getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        getProject, setProject
      • Methods inherited from class java.lang.Object

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

      • TRAC_TICKET_URL_PREFIX

        public static final java.lang.String TRAC_TICKET_URL_PREFIX
        Prefix of the ticket pages in Trac.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AcceptanceTestTask

        public AcceptanceTestTask()
    • Method Detail

      • setConfigFile

        public void setConfigFile​(java.io.File configFile)
        Set the File to read configuration from
        Parameters:
        configFile - the config File
      • setOutputFile

        public void setOutputFile​(java.io.File outputFile)
        Set the File to write output to
        Parameters:
        outputFile - the output file
      • setDatabase

        public void setDatabase​(java.lang.String database)
        Set the database alias
        Parameters:
        database - the database alias
      • execute

        public void execute()
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException - if a problem occurs
        See Also:
        Task.execute()
      • runAllTests

        protected java.util.List<org.intermine.task.AcceptanceTestResult> runAllTests​(Database db,
                                                                                      java.io.LineNumberReader configReader)
                                                                               throws java.io.IOException,
                                                                                      java.sql.SQLException
        Run all the tests and return a List of AcceptanceTestResult objects.
        Parameters:
        db - the Database to run the queries against
        configReader - the reader to get configuration information from.
        Returns:
        a List of AcceptanceTestResult objects
        Throws:
        java.sql.SQLException - if there is a problem running the SQL query
        java.io.IOException - if there is a problem reading or parsing the config file
      • processResults

        protected void processResults​(java.util.List<org.intermine.task.AcceptanceTestResult> testResults,
                                      java.io.PrintWriter pw)
        Write a formatted HTML summary of the given AcceptanceTestResult objects to the PrintWriter.
        Parameters:
        testResults - a List of AcceptanceTestResult objects
        pw - the PrintWriter
      • hyperLinkNote

        public static java.lang.String hyperLinkNote​(java.lang.String note)
        Return a hyperlinked version of the given note.
        Parameters:
        note - the note
        Returns:
        note with trac ticket number (eg. #123) changed to links to trac
      • readOneTestConfig

        public static org.intermine.task.AcceptanceTest readOneTestConfig​(java.io.LineNumberReader configReader)
                                                                   throws java.io.IOException
        Read and return one AcceptanceTest object from the given Reader.
        Parameters:
        configReader - the reader to get configuration information from
        Returns:
        an AcceptanceTest object
        Throws:
        java.io.IOException - if there is a problem reading or parsing the config file