Do large test methods indicate a code smell?
I have a particular method called TranslateValues() (Cyclomatic-Complexity of 5) which I would like to test.
Reusing Mocks/Stubs as Test Specification
We use mock to ensure that a unit test only runs against the code that should be tested. This prevents that a bug in a module A causes tests of a dependent module B to fail. However, now we also have to test the interaction explicitly. It is not enough that A and B are green on their own, A has to work as B expects it, and B has to have the right expectations.
What is a “behavior rich object” and why would it be advantageous?
I am referring to the article Mocks aren’t Stubs by Martin Fowler. When naming cases when he think “mockist” TDD will be advantageous, he said
How would a new language look if it was designed from scratch to be easy to TDD?
With the some most common languages (Java, C#, Java, etc) it sometimes seems that you are working at odds with the language when you want to fully TDD your code.
Who should initialize dependencies in a TDD application?
I’m trying to learn implementing TDD with mocking/fake objects. One of the questions I have is how to initialize a dependency in an application which implements TDD? An example from this article
Beginning Mocking With Moq 3 shows:
Is mocking for unit testing appropriate in this scenario?
I have written around 20 methods in Java and all of them call some web services.
None of these web services are available yet. To carry on with the server side coding, I hard-coded the results that the web-service is expected to give.
Returning a mock object from a mock object
I’m trying to return an object when mocking a parser class. This is the test code using PHPUnit 3.7
Mocking concrete class – Not recommended
I’ve just read an excerpt of “Growing Object-Oriented Software” book which explains some reasons why mocking concrete class is not recommended.
How deep should we dive into testing different layers, i.e. Drupal’s db_query?
We use Drupal 7 as our base CMS tool.
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.