Class InstallerSessionBuilder
java.lang.Object
com.install4j.api.test.session.AbstractSessionBuilder
com.install4j.api.test.session.InstallerSessionBuilder
Builds and starts an
InstallerSession for the install4j installer.
try (InstallerSession session = InstallerSessionBuilder
.forMediaFile(new File("build/media/myapp-linux-x64.sh"))
.installationDirectory(new File(tempDir, "install"))
.start()) {
session.currentScreen().clickNext();
...
}
Kotlin extensions
SessionExtensions.kt in this package adds useSession { ... } as a Kotlin
inline extension: it calls start(), runs the trailing lambda on the resulting
InstallerSession as this, and closes the session afterwards.
InstallerSessionBuilder.forMediaFile(media).useSession {
onScreen("welcome") { clickNext() }
// ...
}
-
Method Summary
Modifier and TypeMethodDescriptionAdditional command-line arguments passed to the installer application.debug(boolean debug) Switch the session to in-process debug mode.static InstallerSessionBuilderforMediaFile(File mediaFile) Create a builder for the given installer media file with extension.exe,.shor.dmg.installationDirectory(File target) Target directory where the installer should install files.Redirect install4j's runtime logger output to the given file.start()Start the installer application and return the typed session handle.systemProperty(String key, String value) Set a system property on the test JVM before the installer starts.Default timeout applied to every wait operation.workingDirectory(File dir) Working directory for the running installer application.
-
Method Details
-
forMediaFile
Create a builder for the given installer media file with extension.exe,.shor.dmg. The file is extracted on first use and cached on disk for subsequent runs. -
installationDirectory
Target directory where the installer should install files. If not set, the session creates a temporary directory and deletes it onSession.close(). User-provided directories are never deleted. -
timeout
Description copied from class:AbstractSessionBuilderDefault timeout applied to every wait operation. The default is 3 minutes. Override per session for longer installations.- Overrides:
timeoutin classAbstractSessionBuilder
-
arg
Description copied from class:AbstractSessionBuilderAdditional command-line arguments passed to the installer application.- Overrides:
argin classAbstractSessionBuilder
-
systemProperty
Description copied from class:AbstractSessionBuilderSet a system property on the test JVM before the installer starts.- Overrides:
systemPropertyin classAbstractSessionBuilder
-
workingDirectory
Description copied from class:AbstractSessionBuilderWorking directory for the running installer application.- Overrides:
workingDirectoryin classAbstractSessionBuilder
-
logFile
Description copied from class:AbstractSessionBuilderRedirect install4j's runtime logger output to the given file.- Overrides:
logFilein classAbstractSessionBuilder
-
debug
Description copied from class:AbstractSessionBuilderSwitch the session to in-process debug mode. By default the test API spawns the produced installer media as a real subprocess (with its bundled JRE, native launcher, and the full extraction code path) and drives it over IPC. In debug mode it runs the installer in the test JVM directly, which is faster but requires aninstall4jc -gdebug build to exist alongside the media file. Use debug mode locally during development; leave it off for CI runs that should exercise the real installer.- Overrides:
debugin classAbstractSessionBuilder
-
start
Description copied from class:AbstractSessionBuilderStart the installer application and return the typed session handle.- Specified by:
startin classAbstractSessionBuilder
-