InstrumentedReportRule
A test rule that builds a detailed report for a test, including its steps.
You can also extend this class to provide a default report configuration across all tests:
class SampleReportRule : InstrumentedReportRule(
reporter = CariocaAllureReporter(),
recordingOptions = RecordingOptions(
bitrate = 20_000_000,
resolutionScale = 1.0f,
),
screenshotOptions = ScreenshotOptions(
scale = 1f
),
interceptors = listOf(LoggerInterceptor(), DumpHierarchyInterceptor())
)
Content copied to clipboard
@get:Rule
val report = SampleReportRule()
@Test
fun sampleTest() = report {
step("Open notification and quick settings") {
step("Open notification") {
device.openNotification()
screenshot("Notification bar visible")
}
step("Open quick settings") {
device.openQuickSettings()
screenshot("Quick settings displayed")
}
}
step("Press home") {
device.pressHome()
}
}
Content copied to clipboard
Parameters
reporter
the instrumented reporter for this report
recordingOptions
the default recording options for this report
screenshotOptions
the default screenshot options for this report
interceptors
the interceptors that will receive multiple stage events during the lifecycle of this report
Constructors
Link copied to clipboard
constructor(reporter: InstrumentedReporter = DefaultInstrumentedReporter(), recordingOptions: RecordingOptions = RecordingOptions(), screenshotOptions: ScreenshotOptions = ScreenshotOptions(), interceptors: List<CariocaInstrumentedInterceptor> = listOf(
LoggerInterceptor(),
TakeScreenshotOnFailureInterceptor(),
DumpViewHierarchyInterceptor(),
))
Public constructor that uses TestStorageProvider to save the reports
Functions
Link copied to clipboard
Use this to track @After
methods separately from the other stages
Link copied to clipboard
Use this to track @Before
methods separately from the other stages
Link copied to clipboard
Same as test, but without the extra method call
Link copied to clipboard
Use this to start reporting the main test body