Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
Best practices
0 votes
2 replies
49 views

I have just started with Kotlin, so I'm not sure what the best practices are. The object file looks like this at the moment, as I am expecting the user's input: object FlowCoordinatorUtil { private ...
-1 votes
1 answer
113 views

I have mocked a class as follows: @Before fun setup() { mockkStatic(MyUtils::class) } @After fun tearDown() { clearStaticMockk(MyUtils::class) } Then i define behavior of MyUtil's ...
1 vote
1 answer
84 views

I want to test that some code updates Micronaut (4.7.5) metrics. (In real life, the code under test gets passed the MeterRegistry and calls its methods.) import io.micrometer.core.instrument.Counter ...
Robert's user avatar
  • 9,086
2 votes
1 answer
210 views

I'm encountering a discrepancy in retrieving a custom CoroutineContext.Element (TraceContextElement) depending on the environment (test vs. production) and how I access the context within a launched ...
0 votes
1 answer
77 views

My app uses Jetpack Compose and includes a WebView. I want to use Mockk (or something like that) in instrumented tests, for example, I want my tests to check that WHEN webView.canGoBack() THEN the ...
2 votes
1 answer
146 views

I see a few posts about this issue, but I still can't resolve this. Can somebody explain why this unit test doesn't work any longer? I've made changes to by build.gradle file, but still no luck. @Test ...
0 votes
2 answers
46 views

I need to verify that exception been thrown or that some logging method been called. Here is my code fun stop() { println("----") CoroutineScope(Dispatchers.IO).launch { try {...
0 votes
0 answers
48 views

I have a unit test that mocks a service with mockk and returns a Result.Success(value) instance when a certain function is called. The problem is that when I go to access the value in the result ...
0 votes
1 answer
109 views

I have a custom junit5 extension, that purpose is to do some clean up after each test class. I want it to be applied to all test classes in multi-module project automatically. Problem is when I enable ...
1 vote
1 answer
115 views

I'm currently facing some problems while adding UnitTests to my JetPack Compose Project. I want to test the following (a bit shortened) function in my viewmodel: fun onPressSignUp() { ...
1 vote
1 answer
212 views

Hi I have some unit tests for my multi-modular Android Project and I want to run a CI pipeline with these tests but as the header says some tests that are using mockk to mocking operations are failing ...
0 votes
0 answers
123 views

I tried to mock the Ktor HttpClient.post(url, HttpRequestBuilder.() -> Unit) in my tests like this. @Test fun `submit report`() = runTest { val mockHttpClient: HttpClient = mockk() val ...
Hantsy's user avatar
  • 9,621
0 votes
1 answer
147 views

I've got a layout hierarchy, that looks like (from top to bottom): SearchResultScreen ProductGridView ———————————————— all composables below are handled by a different team CustomProductTile ...
1 vote
0 answers
150 views

I wrote a Kotlin code and I want to write unit tests for it. But I found that the unit test code I wrote still cannot cover 100% branch coverage. What should I do it? kotlin code: class MyRepository @...
1 vote
0 answers
129 views

Libraries testImplementation("io.mockk:mockk:1.13.12") val junitVintageVersion = "5.10.3" testImplementation("org.junit.vintage:junit-vintage-engine:$...

15 30 50 per page
1
2 3 4 5
...
38

AltStyle によって変換されたページ (->オリジナル) /