Skip to content

//misk-testing/misk.testing

Package-level declarations

Types

Name Summary
ConcurrentMockTracer [jvm]
@Singleton
class ConcurrentMockTracer@Injectconstructor : MockTracer
Extends MockTracer for use in concurrent environments, such as a web server and test client. Prefer this wherever you’d otherwise use MockTracer.
ExternalDependency [jvm]
interface ExternalDependency
An external dependency of the Misk Application that needs to be started for test, like Redis, Vitess, MySQL, SQS, etc.
InjectingParameterResolver [jvm]
class InjectingParameterResolver : ParameterResolver
InjectTest [jvm]
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
@Test
@ExtendWith(value = [InjectingParameterResolver::class])
annotation class InjectTest
LogLevel [jvm]
@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FUNCTION])
annotation class LogLevel(val level: LogLevel.Level = Level.INFO)
Annotate your test classes or methods with @LogLevel to change the log level used by the test. It can be useful to have different LogLevel by test, specially if you’re debugging issues on CI.
LogLevelExtension [jvm]
class LogLevelExtension@Injectconstructor : BeforeEachCallback
MiskExternalDependency [jvm]
@Target(allowedTargets = [AnnotationTarget.FIELD])
annotation class MiskExternalDependency
MiskTest [jvm]
@Target(allowedTargets = [AnnotationTarget.CLASS])
@ExtendWith(value = [MiskTestExtension::class])
annotation class MiskTest(val startService: Boolean = false)
Annotate your test classes with @MiskTest to have fields annotated with @Inject initialized. Provide modules to be installed by annotating a Module field in your test class with MiskTestModule. This can be a compound module, composed using Modules.combine.
MiskTestModule [jvm]
@Target(allowedTargets = [AnnotationTarget.FIELD])
annotation class MiskTestModule
MockTracingBackendModule [jvm]
class MockTracingBackendModule : KAbstractModule
TemporaryFolder [jvm]
class TemporaryFolder(val root: Path)
A temporary folder for use by a given test
TemporaryFolderModule [jvm]
class TemporaryFolderModule : KAbstractModule

Functions

Name Summary
retrieve [jvm]
inline fun <T> ExtensionContext.retrieve(name: String): T
store [jvm]
fun <T> ExtensionContext.store(name: String, value: T)
Stores an object scoped to the test class on the context