Hot answers tagged

9

I would agree with Laurent, and we have faced a very similar situation. Our team tests the APIs for data transport and parsing. The developer unit/component level tests were all against mock objects and data stores. Unit tests are not always comprehensive so we built a 'fake server' to emulate various web services that we used for running additional ...


5

I think "acceptance tests" and "mocking services layers" don't go along. My feeling is that when you do acceptance/functional testing, then you run your whole system in a manner close to the way it will be used although you try to do it in a QA/preprod environment to be confident of the state of your system. If, for the reasons you mention, you can not do ...


4

Should and can I mix Fake and Mock by testing the payload generation part using a Fake and testing if correct endpoints are called by Mocking? Yes, you can freely mix Fakes and Mocks. In fact, a Mock behaves exactly like a Fake with an extra layer of verification added on top (the verification of the calls being made to the Test Double). (A popular ...


3

You can create have multiple implementations of your client object. import abc class MyServiceClient(abc.ABC): @abc.abstractmethod def get_item(self, id): pass class MyServiceClientStub(MyServiceClient): def get_item(self, id): return Item(1) class RealMyServiceClient(MyServiceClient): def get_item(self, id): # ...


3

There will always be some overlap in different tests, but if you look at the test pyramid the different layers have different goals. The test pyramid is a way of thinking about different kinds of automated tests should be used to create a balanced portfolio. Its essential point is that you should have many more low-level UnitTests than high level ...


3

Depends on what your resources are you might want to use either online service like either https://www.mocky.io/ or https://www.mockable.io/ or https://get.mocklab.io/ (that is build on top of wiremock) or https://themockapis.in/ or https://mockapi.io/projects or any other service like there ones or you might install either SoapUI or Postman or Wiremock ...


2

I think the same scenario could happen even if class A uses class B but does not contain class B. One way to mitigate that risk is to write unit tests for class B that validate the assumptions embedded in your mock.


2

Quizzes for all the exam topics. Cheat Sheet that covers all the topics. Summary of the whole syllabus. NOTE : You will have to login to access the quizzes


2

How can I using java and something like rest-assured test this API? can I some how mock it to test or do I need to write my automation code in c# in order to do this? The same way you would with a Java application except it wouldn't be during deploy. The underlying language of the application shouldn't make a difference. Should I deploy the API on to a ...


2

Beeceptor.com, is very powerful tool and i believe it should suffice your need. You can easily do below: Mock your responses Introduce delay Or even just use this as proxy to route your requests to your server. In my case, my server uses third party tool to fetch responses so I have made changes to my config file to hit the beeceptor.com and then through ...


2

Some good practice paper you will find here on istqbexamcertification. Main thing is to concentrate on syllabus given by ISTQB. As per my experience only some time questions come from practice paper in real exam. Paper is always based in ISTQB syllabus. So read , understand and remember each and every line of it.


2

Copying from the linked issue, you could override type to always return 1 when asked about git. functions --copy type builtin_type function type # mock if test "x$argv" = "x-fq git" return 1 end builtin_type $argv # call original end This should work across a variety of environments, and not depend on where git is installed, nor ...


2

TL;DR: Jenkins supports pipelines from code. Make your build, test and deploy pipeline in code and you are not dependent on a specific CD tool. If you can do it from the command line and with API's you can combine and chain any tool or test-step. Use Pipelines as Code! Is it possible to automate this complete process? Probably, but not out of the box with ...


1

You can use Charles Proxy's Re-Write Tool to create rules for capturing certain requests or responses and change on aspects of them.


1

While there's not a lot of details, the unittest.mock library should handle this for you? I think this is what you mean when you say "I know I can set a sequence of return values, but this is limited to a single method" As for future-proofing, if you're trying to test A in isolation, you're verifying that A works with the contracts to B and C not changing. ...


1

If I understand your question correctly you are looking for a way to test processes that check for an invalid db state(s) and fix them. What I can suggest is to make sure that the cron (or another scheduler that handles job execution) contains only the method invocation, and not its definition, that way you can test it without the necessity of running the ...


1

You can try to use mock location indeed after you enabled them, have a lock here: https://www.xda-developers.com/fake-android-location/ Also won't be possible to download the map so that can be consulted offline?


1

You could update the $PATH so that git isn't in it, and then restore it afterwards. However, this will be risky, as it means you'd either need to assume that git is installed somewhere, and just remove that from the path, or determine programmatically where it's located, and remove the path. And then you'd have to worry about it being installed in ...


1

Mocking some endpoint is a must when your application connect to other host which you can't manage all the time , (Eg. third party api to send sms or email) Because sometimes the endpoint do a weekly maintenance or make a change without you knowing it. Also as a QA you want to do a negative case and you want the endpoint give you specific result that ...


1

To test something like this you want your test to not care whether it's connecting to the actual remote database or to a mock database that you manage yourself. It can be an actual, if lightweight, database or a coded representation of one. As long as the class you want to test does not use hard-coded values to connect, you should be able to do this. You ...


1

Turns out this was a bug in TypeMock. It has been fixed in version 8.6.0.18.


1

I've found this site to be pretty good. My favorite though is the Skills NB site. You have to search for the course, but the tests are given in very well manner.


1

It should be realtively easy to setup a server that behaves as your API, but always returns the same values so you can test against it. You just need to make sure you can redirect the traffic from your mobile app to this server. Simplest way is to make it configurable in the app itself. Alternately you can point the production hostname to your test server. ...


1

We used NodeJS to help as out of a similar situation. We designed a mock server on NodeJS and configured REST API to hit Node sever and fetch responses.


1

I had used browsermob-proxy and its Python client successfully in one of my project by using rewrite url to load mocking content. browsermob-proxy is a proxy server for the browser to connect with during testing. Assume you are hosting a webserver with mock content on localhost:8899, below example will load the mock content whenever the browser try to load ...


1

In Selenium features the server and client are running in separate processes. Therefore when mocking time with a tool like Timecop, the browser controlled by Selenium will still see the unmocked system time. Simple case: Synchronizing the client’s time with the mocked server’s time = render "layouts/sinon" # the card attached partial Advanced case ...


1

Yes, you can verify daoInterface.insert is called with verify(daoInterface).insert(anyObject());, but you have to mock DaoInterface first with DaoInterface db = mock(DaoInterface.class);. verify(daoInterface).insert(entity); will fail all the time because entity object from verify's argument and entity inside serviceMessage() are different instance. Instead, ...


1

This is a lot of questions that you might consider splitting up, but here goes: Dependency issue - why is this a problem for unit-testing in Android? Really, this is as much of a problem for Android as it is for anything else. Depending on how you architect your application, isolating from dependencies can easy or hard. There's nothing in your getName ...


1

The first question I would ask myself if I were you: do I have to test how third-party application works (e.g. Does the set of answers lead to an expected data in a csv file?) or do I assume that third-party app works fine and I just need to test integration between my application and third-party (e.g. Is a new csv file added to a shared sftp location gets ...


1

Parth, You have a few options here. Given that your system sends data to the third party system, you either know the format or can get the format of the data to send from your programming team. You know the format of the data returned. This is enough to build a simple simulator that will generate dummy data in the appropriate format given the input. ...


Only top voted, non community-wiki answers of a minimum length are eligible