Class InstallerApplicationSessionBuilder
java.lang.Object
com.install4j.api.test.session.AbstractSessionBuilder
com.install4j.api.test.session.InstallationDirectorySessionBuilder
com.install4j.api.test.session.InstallerApplicationSessionBuilder
Builds and starts an
InstallerApplicationSession for a custom installer application.
try (InstallerApplicationSession session = InstallerApplicationSessionBuilder
.forInstallation(installedDir)
.applicationId("licenseRenewal")
.start()) {
session.currentScreen().clickNext();
...
}
The installer and uninstaller have their own builders, see InstallerSessionBuilder
and UninstallerSessionBuilder.
Kotlin extensions
SessionExtensions.kt in this package adds useSession { ... } as a Kotlin
inline extension: it calls start(), runs the trailing lambda on the resulting
InstallerApplicationSession as this, and closes the session afterwards.
-
Method Summary
Modifier and TypeMethodDescriptionapplicationId(String id) The application id of the installer application to drive.Additional command-line arguments passed to the installer application.debug(boolean debug) Switch the session to in-process debug mode.forInstallation(File installationDirectory) Create a builder for the given installation directory.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
-
forInstallation
@NotNull public static InstallerApplicationSessionBuilder forInstallation(@NotNull File installationDirectory) Create a builder for the given installation directory. Pair withapplicationId(String)to choose the installer application to drive. -
applicationId
The application id of the installer application to drive. Required. -
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
@NotNull public InstallerApplicationSessionBuilder systemProperty(@NotNull String key, @NotNull String value) 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
-