Relative Content

Tag Archive for mocking

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.

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 […]

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?