I'm trying to integrate WireMock to my Android autotests based on JUnit/Espresso/KaspressoI don't need to mock request, I'd like just to verify outgoing requests
build.gradle:
androidTestImplementation "com.github.tomakehurst:wiremock-jre8-standalone:2.35.1"
test class:
val wireMockRule: WireMockRule = WireMockRule(8888)@get:Ruleopen val ruleChain: RuleChain = RuleChain .outerRule(grantPermissionRule) .around(wireMockRule) .around(activityRule)@Testfun testWiremock() { val url = "http://google.com" val client = OkHttpClient() val request = Request.Builder().url(url).build(); val response = client.newCall(request).execute() assertNotNull("just to make sure there is a valid response for this simple request", response.body!!.string()) verify(anyRequestedFor(UrlPattern.ANY))}
result:
com.github.tomakehurst.wiremock.client.VerificationException: Expected at least one request matching: {"method" : "ANY"}Requests received: [ ]
I'm not using newest version of WireMock due to this issue.
also tried on different emulators (API 26 and 34) and real device on Android 13looks like I forgot something but can't understand what is it. please help