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
Do unit tests sometimes break encapsulation? [duplicate]
This question already has answers here: Should I avoid private methods if I perform TDD? (14 answers) Closed 10 years ago. I very often hear the following: “If you want to test private methods, you’d better put that in another class and expose it.” While sometimes that’s the case and we have a hiding concept […]
Are injectable classes allowed to have constructor parameters in DI?
Given the following code:
Is wrapping a third party code the only solution to unit test its consumers?
I’m doing unit testing and in one of my classes I need to send a mail from one of the methods, so using constructor injection I inject an instance of Zend_Mail
class which is in Zend framework.
What to do when TDD tests reveal new functionality that is needed that also needs tests?
What do you do when you are writing a test and you get to the point where you need to make the test pass and you realize that you need an additional piece of functionality that should be separated into its own function? That new function needs to be tested as well, but the TDD cycle says to Make a test fail, make it pass then refactor. If I am on the step where I am trying to make my test pass I’m not supposed to go off and start another failing test to test the new functionality that I need to implement.
What if I can’t make my unit test fail in “Red, Green, Refactor” of TDD?
So let’s say that I have a test:
How can I test database access methods in Java? [closed]
It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. I want to write a test for a […]
How to TDD test that objects are being added to a collection if the collection is private?
Assume that I planned to write a class that worked something like this:
Unit test and Code Coverage of Ant build scripts
In our development environment We have more and more build scripts for ant to perform the build tasks for several different build jobs.
How do you handle increasingly long compile times when working with templates?
I use Visual Studio 2012 and he have cases where we added templates parameters to a class “just” in order to introduce a “seam point” so that in unit-test we can replace those parts with mock objects.