How would type errors be detected while creating mocks in a dynamic language?
The problem occurs while doing TDD. After a couple of test pass, the return types of some class/module change. In a statically typed programming language, if a previous mocked object was used in the tests of some other class and was not modified to reflect the type change, then compilation errors will occur.
Is it okay to mock multiple objects in one class?
For developers with extensive experience using mocks, is it okay to mock multiple objects in one class (ie satisfy multiple interfaces) or is this not recommended?
Unit Testing Open Source projects that require keys for api calls
What’s the recommended method for setting up tests on code that requires a private key to make calls to external web services?
Is this an appropriate use of Mockito’s reset method?
I have a private method in my test class that constructs a commonly used Bar
object. The Bar
constructor calls someMethod()
method in my mocked object:
Mock up class object
For example I have class ItemDownloader
which has method downloadItem
. This method creates instance of another class – Download
to perform actual downloading.
Brittle unit tests due to need for excessive mocking
I’ve been struggling with an increasingly annoying problem regarding our unit tests that we are implementing in my team. We are attempting to add unit tests into legacy code that wasn’t well designed and while we haven’t had any difficulty with the actual addition of the tests we are starting to struggle with how the tests are turning out.
Unit-testing functions without business logic (only checks) [duplicate]
This question already has answers here: Is it useful to unit test methods where the only logic is guards? (5 answers) Closed 11 years ago. My team is trying to find out the best way to test one of our components; the main scope is to check if the user/actor has the right to complete […]
What is the most appropriate testing method in this scenario?
I’m writing some Objective-C apps (for OS X/iOS) and I’m currently implementing a service to be shared across them. The service is intended to be fairly self-contained.
when to mock in unit testing [duplicate]
Should I mock the Roads class and send it as a parameter to Vehicles for unit testing?
OR Should I just create a new object and send it as a parameter to Vehicles?
Mocking complex data operations in integration tests
We have some problems figuring out how to mock complex data and operations on it.