Class TestUtils


  • public class TestUtils
    extends Object
    Utility methods for setting up selection and operation-history logging in integration tests that use a generator.
    • Field Detail

      • debug

        static boolean debug
    • Constructor Detail

      • TestUtils

        public TestUtils()
    • Method Detail

      • setAllLogs

        public static void setAllLogs​(AbstractGenerator generator)
        Use system properties to set command-line arguments for logging.

        This has no effect unless tests are run with gradle command-line options such as

         -Drandoop.log=randoop-log.txt
         -Drandoop.selection.log=selection-log.txt
         -Drandoop.operation.history.log=operation-log.txt
         
        Parameters:
        generator - the AbstractGenerator in which to set the operation log
      • setRandoopLog

        public static void setRandoopLog()
        Uses the system property randoop.log to set GenInputsAbstract.log.
      • setRandoopLog

        public static void setRandoopLog​(@Nullable String filename)
        Uses the argument to set GenInputsAbstract.log.
        Parameters:
        filename - the file to write the log to; does nothing if filename is null
      • setSelectionLog

        public static void setSelectionLog​(@Nullable String filename)
        Uses the argument to set GenInputsAbstract.selection_log.
        Parameters:
        filename - the file to write the log to; does nothing if filename is null
      • setSelectionLog

        public static void setSelectionLog​(org.plumelib.util.FileWriterWithName fw)
        Uses the argument to set GenInputsAbstract.selection_log.
        Parameters:
        fw - the FileWriter to write the log to; does nothing if fw is null
      • setOperationLog

        public static void setOperationLog​(AbstractGenerator generator)
        If the system property randoop.operation.history.log is set, sets the operation history logger for the generator using the destination given by the property.
        Parameters:
        generator - the generator for which logger is to be set
      • setOperationLog

        public static void setOperationLog​(@Nullable String filename,
                                           AbstractGenerator generator)
        If the filename is non-null, sets the operation history logger for the generator using it.
        Parameters:
        filename - the file to write the log to; does nothing if filename is null
        generator - the generator for which logger is to be set
      • setOperationLog

        public static void setOperationLog​(PrintWriter pw,
                                           AbstractGenerator generator)
        If the PrintWriter is non-null, sets the operation history logger for the generator using it.
        Parameters:
        pw - the PrintWriter to write the log to; does nothing if pw is null
        generator - the generator for which logger is to be set