mockwebserver Questions
3
Solved
I have a repository that creates a flow where I emit the result of a suspending Retrofit method. This works in the app, but I would like to run tests on the code.
I am using kotlinx-coroutines-test...
Pettish asked 4/4, 2022 at 1:33
4
Solved
I'm using spring-boot with WebClient, which is autowired as a bean.
Problem: when writing a junit integration test, I have to use okhttp MockWebServer. This mock always starts up on a random port,...
Cashier asked 24/7, 2019 at 15:55
3
I'm using MockWebServer library in my Android JUnit tests. I'm testing an SDK that makes calls to a server. So I'm using MockWebServer to override these server URLs and capture what the SDK is send...
Iritis asked 11/9, 2013 at 20:34
1
Solved
I am performing instrumentation testing, in that I am invoking one of the activities which call 2 APIs when activity is created.
Now I want to write instrumentation test cases for this activity, w...
Rosemare asked 13/10, 2019 at 19:43
4
Solved
I'm trying to test HTTP timeout scenarios using a MockWebServer which answers my test requests sent with Retrofit/OkHttp. (This question was asked before some years ago, but at the time concerned a...
Dihydrostreptomycin asked 22/9, 2016 at 12:23
2
I am sending a request to a MockWebServer. I want to checkout parameters of said request for testing purposes. How can I extract it from MockWebServer?
Starkey asked 5/1, 2021 at 4:8
4
I try to enable SSL on Square's MockWebServer to mock all webservice calls in my Android App under Test. I want to enable SSL to get the same errors like under real conditions. I don't want to disa...
Linnette asked 2/12, 2015 at 7:56
1
I am using Espresso to write UI tests for my Android application and would like to mock http requests using MockWebServer.
I need to mock authentication responses and sign in the user before the t...
Pemphigus asked 29/12, 2016 at 20:21
3
Solved
How can I delay a Square MockWebServer HTTP response?
There is a response.setBodyDelayTimeMs(...); method but this is only used in SpdySocketHandler and not for HTTP requests.
Doubleripper asked 6/11, 2014 at 11:29
6
Solved
I want to simulate the no network case when using RetroFit and MockWebServer.
Im currently testing using Espresso and supplying the MockWebServers url to the RestAdapter before I start my tests. ...
Otalgia asked 25/7, 2014 at 9:34
1
I'm testing api that returns result using suspending function with MockWebServer, but it does not work with runBlockingTest, testCoroutineDispatcher, testCorounieScope unless a launch builder is us...
Pa asked 2/6, 2020 at 21:29
0
I am getting this error java.io.ioexception gave up waiting for executor to shut down when I do mockwebserver.shutdown(). I can see in the debug trace that the server has few active threads which i...
Seng asked 23/6, 2021 at 16:38
3
Solved
I built my Retrofit instance like this:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(server.url("/"))
.addConverterFactory(MoshiConverterFactory.create(moshi))
.build();
Then I am call...
Unregenerate asked 3/5, 2016 at 17:40
0
I am trying to write UI test for my Fragments with Espresso and MockWebServer. I am using OkHttp Idling Resource to tell Espresso to wait for the API calls to complete.
But somehow, sometimes my te...
Prelusive asked 28/3, 2021 at 17:39
1
Solved
I am trying to use okhttp3.mockwebserver.MockWebServer for some intrumented testing on Android. This is what I have in my build.gradle (:app) file for instrumented testing:
androidTestImplementati...
Campagna asked 23/11, 2020 at 22:47
2
Solved
How can we test a suspending function with MockWebServer that supposed to throw exception?
fun `Given Server down, should return 500 error`()= testCoroutineScope.runBlockingTest {
// GIVEN
mock...
Deceleron asked 3/6, 2020 at 5:54
0
I have a modularised project, where the api layer is separated into its own module. As this has no dependency on the Android SDK, I have made it a kotlin only module. This has the kotlin jvm plugin...
Debi asked 21/2, 2020 at 8:43
2
Solved
I'm working on an android library project, where I need to download an PNG image from a REST service, transform it into a Bitmap and return it to the app(s) using this library. So, we have a REST w...
Twayblade asked 2/6, 2016 at 5:58
11
Solved
What's the best way to mock a server for testing when using the square retrofit framework.
Potential ways:
Create a new retrofit client and set it in the RestAdapter.Builder().setClient(). This ...
Arteaga asked 9/7, 2013 at 9:29
1
Solved
I want to create an integration test and mock a remote webservice as follows:
MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse()...);
server.enqueue(new MockResponse().....
Vaenfila asked 15/8, 2019 at 12:42
3
Solved
I would like to simulate network communication by MockWebServer. Unfortulatelly retrofit callbacks are never invoking. My code:
MockWebServer server = new MockWebServer();
server.enqueue(new Mo...
Petrozavodsk asked 30/6, 2014 at 12:11
2
Solved
Trying MockWebServer for the first time on a Groovy/Spring project that uses Spock for unit testing.
I added MockWebServer dependencies as directed (I had to add the second line myself to avoid er...
Ferretti asked 2/7, 2019 at 14:18
1
Solved
I am writing test for an Activity which makes several consecutive calls to server.
My MockWebServer mixes sequence of responses.e.g. When I make two consecutive requests request1 and request2 it so...
Rhianna asked 31/1, 2019 at 10:54
1
I'm using RESTMock for my instrumentation tests, but it only works if I set usesCleartextTraffic to true in my manifest. I only want that to be true for instrumentation tests, though. Is there a wa...
Antelope asked 16/12, 2018 at 16:59
1
Solved
I recently discovered MockWebServer library and I try to use it in my project with Junit and mockito.
I have this test method:
@Test
public void testGetUsers() throws Exception {
MockWebServe...
Dinerman asked 22/11, 2018 at 13:30
1 Next >
© 2022 - 2025 — McMap. All rights reserved.