Appreciate any good example or references to websites which has useful information of using TDD with Model-View-Presenter pattern using Rhino Mocks.
What I am looking for is with respect to the following points
What to mock (view and presenter)
The new AAA syntax
How to mock UI behaviour? e.g. if "firstName" and "lastName" entered in...
With MS ramming powershell into all new server products, I'm starting to (reluctantly) think I need to take it seriously. Part of "taking it seriously" is TDD. Have you found good methods to unit test power shell scripts?
I've found samples of mocking from Mr Geek Noise - but I'd really like something like RhinoMocks. Brian Hartsock ha...
I have been practicing TDD and (some) XP for a few years now and have found that it solves many of the problems I had in my career previous to it's adoption. By removing so many headaches, my love of coding has been rejuvenated. The problem is I have also found it difficult to find .NET (my current stack) projects utilizing these pract...
I'd like to know your thoughts about test/mocking frameworks that are widely used and have a good level of compatibility between Java and .NET. I mean, I want to learn those tools to use in a .NET project, but I still wanna be able to apply that knowledge in Java projects.
I know there're many questions about test/mocking frameworks to...
When I write code I only write the functions I need as I need them.
Does this approach also apply to writing tests?
Should I write a test in advance for every use-case I can think of just to play it safe or should I only write tests for a use-case as I come upon it?
...
The standard process for test-driven development seems to be to add a test, see it fail, write production code, see the test pass, refactor, and check it all into source control.
Is there anything that allows you to check out revision x of the test code, and revision x-1 of the production code, and see that the tests you've written in ...
I'm very new to TDD and I'm having trouble with one of my unit tests. I just can't seem to understand what to do next. :( I'm trying to unit test a service of mine called AccountService and I'm testing a method called DoLogin(username, password). Here's some example code:
[Test]
public void User_With_Correct_Username_And_Pass_Sh...
I'm working on a pretty standed ASP.NET MVC application. We've got the core logic behind a set of services and we're using StructureMap to inject appropriate instances of appropriate IRepositories to abstract communications with the data layer proper. We've also got a rather exhaustive series of unit tests on these services. But, as thin...
Let's say I have an object Employee_Storage that contains a database connection data member. Should this data member be stored as a pointer or as a reference?
If I store it as a reference, I
don't have to do any NULL
checking. (Just how important is NULL checking anyway?)
If I store it as a pointer, it's
easier to setup E...
How much should each of my unit tests examine? For instance I have this test
[TestMethod]
public void IndexReturnsAView()
{
IActivityRepository repository = GetPopulatedRepository();
ActivityController activityController = GetActivityController(repository);
ActionResult result = activityController.Index();
Assert.IsInst...
Question
How do you handle read-only fields when creating fakes?
Background
I'm in the beginner stages of using ASP.Net MVC and am using Steven Sanderson's Sports Store and Scott Gu's Nerd Dinner as examples. One small problem that I've just hit is how to work with read-only properties when doing fakes. I'm using LINQToSQL.
My interf...
I'm writing a custom Profile provider, but I still intend to use the default AspNetSqlMembershipProvider as my Membership provider. My GetAllProfiles() method in my Profile provider looks like this:
1 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, o...
I'm coming from a big design background, and just learning TDD/BDD so bear with me if this is a simple question. It seems that many client decisions aren't actually recorded anywhere - they're just documented in the code and tests. So my question is: what happens when the client changes some of these undocumented decisions? How do yo...
Do you prefer literal values or expressions in your Asserts in your unit tests? This little example demonstrates what I mean - please pay attention to the comments:
[Test]
public function fromXML_works() : void {
var slideshow : Slideshow = SlideshowConverter.fromXML(xmlSample);
// do you prefer literal value "1":
assertEqu...
I am trying to test that a field is being generated properly by a callback, but I can't figure this one out.
album.rb
before_create :generate_permalink
private
def generate_permalink
@title = album.downcase.gsub(/\W/, '_')
@artist = artist.downcase.gsub(/\W/, '_')
self.permalink = @artist + "-" + @title
end
albu...
Has anyone experienced any issues with using the mstest attribute [AssemblyInitialize] when running tests with TestDriven.Net?
I've tried 2.14 RTM and 2.22 RTM and neither seem to work for me. When I execute the test, the assembly init method isn't being executed. It's like TD.Net doesn't recongize the attribute.
Any tips/ideas/clues i...
In a few of my controllers I have a before_filter that checks if a user is logged in? for CRUD actions.
application.rb
def logged_in?
unless current_user
redirect_to root_path
end
end
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = U...
What is the purpose of mocking?
I have been following some ASP.NET MVC tutorials that use NUnit for testing and Moq for mocking. I am a little unclear about the mocking part of it though.
...
Over the past year or so I have been developing my TDD chops so that I am now fairly good at the essentials - writing tests first, mocking frameworks, testing as small things as possible, DI etc.
However I feel like there are still a lot of things that I am not getting out of unit testing.
For example, I often find that unit testing in...
I have just read Michael C. Feathers great book Working Effectively with Legacy Code, the bible of introducing tests to legacy code. In this book he describes something called Edit-triggered testing:
If it isn't out by the time this book is released, I suspect that someone will soon develop an IDE that allows you to specify a set of ...