Class TestFramework

java.lang.Object
net.minecraftforge.eventtest.internal.TestFramework

public class TestFramework extends Object
The backend of the "curletest" event testing framework. All tests are registered to this class, and are set up according to the needs they declare. All bootstrap tests will be summed up into a log file when the main menu loads. All gameplay events will be printed to the console when they fire, and written to the above log. To register a new event test, simply create the class in the events package and add it to the list here.
  • Field Details

    • MODID

      public static final String MODID
      See Also:
    • tests

      final List<EventTest> tests
    • testNames

      static final Map<EventTest,String> testNames
    • LOGGER

      static final org.apache.logging.log4j.Logger LOGGER
    • CURLETEST_ANNOTATION

      static final org.objectweb.asm.Type CURLETEST_ANNOTATION
    • bootstrapHandled

      boolean bootstrapHandled
  • Constructor Details

    • TestFramework

      public TestFramework()
      Pre-initialize the framework and all events.
  • Method Details

    • testChangedState

      public static void testChangedState(EventTest test)
      Gameplay events require to be able to notify the framework when their task is completed. Bootstrap events are ignored when updates occur.
    • gatherEvents

      private List<EventTest> gatherEvents()
      Enumerate all tests that should be ran with the framework. All classes with the @TestHolder annotation are resolved and instantiated as tests.
      Returns:
      all tests to run
    • collectBootstrapTests

      private void collectBootstrapTests(ScreenEvent.Opening event)
      At the mark of the end of the bootstrap period, collect and log all test results. the ScreenOpenEvent fired by TitleScreen is the last event fired without user interaction, so it is the end of the "automatic" bootstrap time.
    • collectMissedTests

      private void collectMissedTests(GameShuttingDownEvent event)
      Search for unfired events when the game is shutting down. Summarise all test results.
    • prepareLogger

      private void prepareLogger()
      Set the LOGGER instance in this class to only write to logs/curletest.log. Log4J is annoying and requires manual initialization and preparation.
    • getLoggerConfiguration

      private static org.apache.logging.log4j.core.config.LoggerConfig getLoggerConfiguration(@NotNull @NotNull org.apache.logging.log4j.core.config.Configuration configuration, @NotNull @NotNull String loggerName)