I had an instrumented test that worked, however, then was added additional param to the object which required to call the @Composable
function, so the entire test method should be marked as @Composable
, so I added this annotation to the function, however, it starts to throw the error:
org.junit.runners.model.InvalidTestClassError: Invalid test class 'entpay.awl.ui.component.showpage.ScreenKtTest':
1. Method testDetails should have no parameters
So, the method looks like this
@Test
@Composable. <------ Composable annotation
fun testDetails() {
....
val window: WindowSize = rememberWindowSize() <------ This method is Composable
composeTestRule.setContent {
Details(
config = ...,
windowSize = window
)
}
}
I am a new in instrumental testing, however, I assume that I can't use @Composable
methods in testing directly
How to make it work?
UPD
I also tried to put the window
line in setContent
, result the same
....
composeTestRule.setContent {
val window: WindowSize = rememberWindowSize()
Details(
config = ...,
windowSize = window
)
}