IntegrationTester

mill.testkit.IntegrationTester
See theIntegrationTester companion object
class IntegrationTester(val daemonMode: Boolean, val workspaceSourcePath: Path, val millExecutable: Path, val debugLog: Boolean, val baseWorkspacePath: Path, val propagateJavaHome: Boolean, val cleanupProcessIdFile: Boolean) extends Impl

Helper meant for executing Mill integration tests, which runs Mill in a subprocess against a folder with a build.mill and project files. Provides APIs such as eval to run Mill commands and out to inspect the results on disk. You can use modifyFile or any of the OS-Lib os.* APIs on the workspacePath to modify project files in the course of the test.

Value parameters

daemonMode

Whether to run Mill in client-server mode. If false, Mill is run with --no-server

millExecutable

What Mill executable to use.

workspaceSourcePath

The folder in which the build.mill and project files being tested comes from. These are copied into a temporary folder and are not modified during tests

Attributes

Companion
object
Source
IntegrationTester.scala
Graph
Supertypes
trait Impl
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited classlikes

class Meta(selector0: String)

Attributes

Inherited from:
Impl
Source
IntegrationTester.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Inherited methods

override def close(): Unit

Tears down the workspace at the end of a test run, shutting down any in-process Mill background servers

Tears down the workspace at the end of a test run, shutting down any in-process Mill background servers

Attributes

Definition Classes
Impl -> AutoCloseable
Inherited from:
Impl
Source
IntegrationTester.scala
def eval(cmd: Shellable, env: Map[String, String], cwd: Path, stdin: ProcessInput, stdout: ProcessOutput, stderr: ProcessOutput, mergeErrIntoOut: Boolean, timeout: Long, check: Boolean, propagateEnv: Boolean, timeoutGracePeriod: Long): EvalResult

Evaluates a Mill command. Essentially the same as os.call, except it provides the Mill executable and some test flags and environment variables for you, and wraps the output in a IntegrationTester.EvalResult for convenience.

Evaluates a Mill command. Essentially the same as os.call, except it provides the Mill executable and some test flags and environment variables for you, and wraps the output in a IntegrationTester.EvalResult for convenience.

Attributes

Inherited from:
Impl
Source
IntegrationTester.scala
def initWorkspace(): Unit

Initializes the workspace in preparation for integration testing

Initializes the workspace in preparation for integration testing

Attributes

Inherited from:
IntegrationTesterBase
Source
IntegrationTesterBase.scala
def millTestSuiteEnv: Map[String, String]

Attributes

Inherited from:
IntegrationTesterBase
Source
IntegrationTesterBase.scala
def modifyFile(p: Path, f: String => String): Unit

Helper method to modify a file containing text during your test suite.

Helper method to modify a file containing text during your test suite.

Attributes

Inherited from:
Impl
Source
IntegrationTester.scala
def out(selector0: String): Meta

Helpers to read the .json metadata files belonging to a particular task (specified by selector0) from the out/ folder.

Helpers to read the .json metadata files belonging to a particular task (specified by selector0) from the out/ folder.

Attributes

Inherited from:
Impl
Source
IntegrationTester.scala
def prepEval(cmd: Shellable, env: Map[String, String], cwd: Path, stdin: ProcessInput, stdout: ProcessOutput, stderr: ProcessOutput, mergeErrIntoOut: Boolean, timeout: Long, check: Boolean, propagateEnv: Boolean, timeoutGracePeriod: Long): PreparedEval

Prepares to evaluate a Mill command. Run it with IntegrationTester.PreparedEval.run.

Prepares to evaluate a Mill command. Run it with IntegrationTester.PreparedEval.run.

Useful when you need the IntegrationTester.PreparedEval.clues.

Attributes

Inherited from:
Impl
Source
IntegrationTester.scala
def removeProcessIdFile(): Unit

Remove any ID files to try and force them to exit

Remove any ID files to try and force them to exit

Attributes

Inherited from:
IntegrationTesterBase
Source
IntegrationTesterBase.scala

Concrete fields

val baseWorkspacePath: Path

Attributes

Source
IntegrationTester.scala
val cleanupProcessIdFile: Boolean

Attributes

Source
IntegrationTester.scala
val daemonMode: Boolean

Attributes

Source
IntegrationTester.scala
override val debugLog: Boolean

Attributes

Source
IntegrationTester.scala
val millExecutable: Path

Attributes

Source
IntegrationTester.scala
val propagateJavaHome: Boolean

Attributes

Source
IntegrationTester.scala

Attributes

Source
IntegrationTester.scala

Inherited fields

val workspacePath: Path

The working directory of the integration test suite, which is the root of the Mill build being tested. Contains the build.mill file, any application code, and the out/ folder containing the build output

The working directory of the integration test suite, which is the root of the Mill build being tested. Contains the build.mill file, any application code, and the out/ folder containing the build output

Each integration test that runs in the same baseWorkspacePath is given a new folder for isolation purposes; even though we try our best to clean up the processes and files from each Mill run, it still doesn't work 100%, and re-using the same folder can cause non-deterministic interference and flakiness

Attributes

Inherited from:
IntegrationTesterBase
Source
IntegrationTesterBase.scala