IviServiceTestCase

abstract class IviServiceTestCase(initialIviServiceTestConfiguration: IviServiceTestConfiguration? = DEFAULT_INITIAL_SERVICE_CONFIG) : IviFunctionalTestCase, IviServiceAwareTestCase

Base class for running tests that require one or more IVI services.

Test cases can configure:

  • Which IVI services are registered.

  • Which IVI services are mocked.

The mocked IVI services all run inside the main process, allowing the test access to the mocks.

The IVI service configurations offered by this class are limited to the main process and thus limited to single process setups only or, when using services in other processes, limited to services that do not need any other non-mocked services. The alternative is to extend the TestApplication and set TestApplication.iviServiceTestConfiguration. A combination is also possible.

The configuration providers are configured at build time and available in all processes. Gradle plugins that implement the com.tomtom.ivi.gradle.api.common.defaults.IviDefaultsPlugin class can configure static and dynamic configuration providers.

Note: This class depends on the TestApplication to be used as the Application class of the test apk.

Parameters

initialIviServiceTestConfiguration

The initial service configuration to setup when not null.

Constructors

Link copied to clipboard
fun IviServiceTestCase(initialIviServiceTestConfiguration: IviServiceTestConfiguration? = DEFAULT_INITIAL_SERVICE_CONFIG)

Types

Link copied to clipboard
object Companion

Properties

Inherited properties

Link copied to clipboard
open override val clearSharedPreferencesRule: ClearSharedPreferencesRule
Link copied to clipboard
val locationManager: LocationManager
Link copied to clipboard
val ruleChain: RuleChain
Link copied to clipboard
val serviceRulesChain: RuleChain
Link copied to clipboard
val testLifecycleOwner: TestLifecycleOwner
Link copied to clipboard
val testPackageName: String

Functions

Link copied to clipboard
open override fun <R> createApiWrapper(iviInstanceId: IviInstanceId, callback: CreateApiCallback<R>): R
Link copied to clipboard
open override fun getServiceIdsWrapper(iviInstanceId: IviInstanceId, callback: GetServiceIdsCallback): List<IviServiceId>
Link copied to clipboard
fun hasIviServiceMock(iviServiceMockIdentifier: IviServiceMockIdentifier<*>): Boolean

See the IviServiceRule.hasIviServiceMock overload that takes a IviServiceMockIdentifier instance.

fun hasIviServiceMock(iviServiceMockClass: KClass<out AnyIviServiceBase>): Boolean

See the IviServiceRule.hasIviServiceMock overload that takes a KClass instance.

Link copied to clipboard
fun <T : AnyIviServiceBase, R> withIviServiceMockOnMainThread(iviServiceMockIdentifier: IviServiceMockIdentifier<T>, block: T.() -> R): R
fun <T : AnyIviServiceBase, R> withIviServiceMockOnMainThread(iviServiceMockClass: KClass<T>, block: T.() -> R): R

See the IviServiceRule.withIviServiceMockOnMainThread overload that takes a KClass instance.

Link copied to clipboard
fun <T : AnyIviServiceBase, R> withIviServiceMockOnTestThread(iviServiceMockIdentifier: IviServiceMockIdentifier<T>, block: T.() -> R): R
fun <T : AnyIviServiceBase, R> withIviServiceMockOnTestThread(iviServiceMockClass: KClass<T>, block: T.() -> R): R

See the IviServiceRule.withIviServiceMockOnTestThread overload that takes a KClass instance.

Inherited functions

Link copied to clipboard
inline fun <T : TraceEventConsumer> createTraceEventConsumer(localProcessOnly: Boolean): T
Link copied to clipboard
fun initializeTest()
Link copied to clipboard
fun registerTraceEventConsumer(    traceEventConsumer: TraceEventConsumer,     contextRegex: Regex?,     localProcessOnly: Boolean)
Link copied to clipboard
open fun setOrientationLandscape()
Link copied to clipboard
open fun setOrientationPortrait()

Inheritors