Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3641

WireMock on Android: empty list of received requests

$
0
0

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


Viewing all articles
Browse latest Browse all 3641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>