Class GameTestConfiguration

java.lang.Object
org.spongepowered.gradle.plugin.config.GameTestConfiguration

public abstract class GameTestConfiguration extends Object
Runs the plugin's gametests, the @GameTest methods under src/gametest, through the gametest test suite and its task, or another one, see getSuite(): the platform's gametest module is added to the suite's classpath, the Sponge runtime boots in its JVM before JUnit discovers anything, and the plugin's own output is handed to it to load. Unless gametests are put in test, it is left alone, so unit tests run without a game. Every value has a working default.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GameTestConfiguration(org.gradle.api.model.ObjectFactory factory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    exclude(String... modules)
     
    org.gradle.api.provider.Property<Boolean>
    Whether the gametest suite is set up; sponge.gameTests { } turns it on.
    org.gradle.api.provider.SetProperty<String>
    Modules of the gametest runtime classpath kept out of the libraries, as group:module or a whole group: what another platform's module brings along, or a test-only dependency the game should not see.
    org.gradle.api.provider.Property<String>
    The launch target the Sponge runtime boots with; the headless game test server by default.
    org.gradle.api.file.ConfigurableFileCollection
    What Sponge loads beside the plugin as game-layer libraries, each its own module.
    org.gradle.api.file.ConfigurableFileCollection
    What Sponge loads as the plugin under test, as one plugin resource: by default the main and gametest outputs and the jars of the projects this one depends on, a multi-module plugin's other parts.
    org.gradle.api.provider.Property<String>
    The plugin the tests belong to, which prefixes their names: <plugin id>.<group>.<method_name>.
    org.gradle.api.provider.Property<Boolean>
    Whether failing gametests fail the build, the default.
    org.gradle.api.provider.Property<String>
    The JVM test suite the gametests run in, with its source set and task of the same name; gametest by default.
    org.gradle.api.provider.Property<String>
    The version of the platform's gametest module, org.spongepowered:<platform>-gametest.
    org.gradle.api.file.DirectoryProperty
    Where the game test server runs; build/gametest-run by default, with the EULA accepted.
    void
    launchTarget(String launchTarget)
     
    void
    libraries(Object... paths)
     
    void
    plugin(Object... paths)
     
    void
    pluginId(String pluginId)
     
    void
    required(boolean required)
     
    void
    suite(String suite)
     
    void
    version(String version)
     

    Methods inherited from class java.lang.Object

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

    • GameTestConfiguration

      @Inject public GameTestConfiguration(org.gradle.api.model.ObjectFactory factory)
  • Method Details

    • getEnabled

      public org.gradle.api.provider.Property<Boolean> getEnabled()
      Whether the gametest suite is set up; sponge.gameTests { } turns it on.
    • getRequired

      public org.gradle.api.provider.Property<Boolean> getRequired()
      Whether failing gametests fail the build, the default. The gametest task always runs as part of check; required(false) makes it an optional check, whose failures are reported without failing the build.
    • required

      public void required(boolean required)
    • getSuite

      public org.gradle.api.provider.Property<String> getSuite()
      The JVM test suite the gametests run in, with its source set and task of the same name; gametest by default. A suite of that name that exists already is used as it is, as test is with suite("test"), which runs the gametests in src/test through the test task alongside any unit tests. Otherwise the plugin creates it, on top of the plugin's own classes and dependencies, once sponge.gameTests is configured.
    • suite

      public void suite(String suite)
    • getVersion

      public org.gradle.api.provider.Property<String> getVersion()
      The version of the platform's gametest module, org.spongepowered:<platform>-gametest. Defaults to the version of the Sponge runtime runServer resolves, so the two always match.
    • version

      public void version(String version)
    • getLaunchTarget

      public org.gradle.api.provider.Property<String> getLaunchTarget()
      The launch target the Sponge runtime boots with; the headless game test server by default.
    • launchTarget

      public void launchTarget(String launchTarget)
    • getPluginId

      public org.gradle.api.provider.Property<String> getPluginId()
      The plugin the tests belong to, which prefixes their names: <plugin id>.<group>.<method_name>. Defaults to the plugin this project declares, when it declares exactly one; a module whose metadata another module writes names it here.
    • pluginId

      public void pluginId(String pluginId)
    • getPluginFiles

      public org.gradle.api.file.ConfigurableFileCollection getPluginFiles()
      What Sponge loads as the plugin under test, as one plugin resource: by default the main and gametest outputs and the jars of the projects this one depends on, a multi-module plugin's other parts. A built jar can stand in, e.g. plugin(tasks.named("shadowJar")). Jars are listed before directories, since Sponge reads the manifest from the last path.
    • plugin

      public void plugin(Object... paths)
    • getLibraries

      public org.gradle.api.file.ConfigurableFileCollection getLibraries()
      What Sponge loads beside the plugin as game-layer libraries, each its own module. The modules on the gametest runtime classpath are there by default, less JUnit and anything the game loads itself: Minecraft and the API with their dependencies, and the libraries the Sponge runtime installs. libraries(...) adds to that: a file dependency, a configuration, a task's jar.
    • libraries

      public void libraries(Object... paths)
    • getExcludes

      public org.gradle.api.provider.SetProperty<String> getExcludes()
      Modules of the gametest runtime classpath kept out of the libraries, as group:module or a whole group: what another platform's module brings along, or a test-only dependency the game should not see.
    • exclude

      public void exclude(String... modules)
    • getWorkingDirectory

      public org.gradle.api.file.DirectoryProperty getWorkingDirectory()
      Where the game test server runs; build/gametest-run by default, with the EULA accepted.