tdd

How did you extend your Assert class

I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: ImageAssert, XmlAssert etc.. Did you Create your own Assert classes? and what kind of new would you like to create? ...

Separate Class vs Method

Quick design question. ClassA has a method called DoSomething(args) In DoSomething(), before it can actually do something, it needs to do some preparatory work with args. I believe this should be encapsulated within ClassA, (as opposed to doing the prep work outside and passing it in) as nothing else needs to know that this prep work ...

How to apply Test Driven development for GUI application(VC MFC)?

Can I use TDD for gui application? How to do it. ...

TDD: Which methods do you expose for unit testing?

There is one aspect of TDD which I never fully understood. Suppose somebody asked you to implement a simple Stack object. If you've done your design properly, you will come to a very minimal and clean API. Suppose: push(), pop() and isEmpty(). Anything more than that is over-killing the demand, and allowing the user too much room to mes...

What a good strategy or tool to unit test database conversions? (Not unit testing databases, but the conversion)

I am working on a project where we are converted the old system to a brand new system. We are currently converted from the database of the old system to the database of the new system, and a team is working on creating a set of maps and transforms to run at the end of development to convert over the old system. I would like to implemen...

Testing Data Access Persist Methods

Hi guys Just wondering if anyone has any ideas on how to test ones data access methods. I have found testing retrieval data access methods is much easier because i can just mock out the ExecuteReader and return a populated dataTable.CreateDataReader(). By doing this I can test to see if my object is populating correctly if a result set ...

Design By Contract and Test-Driven Development

I'm working on improving our group's development process, and I'm considering how best to implement Design By Contract with Test-Driven Development. It seems the two techniques have a lot of overlap, and I was wondering if anyone had some insight on the following (related) questions: Isn't it against the DRY principle to have TDD and ...

Strategies for Using Mock Objects when Unit Testing DAOs

I am curious what strategies folks have found for unit testing a data access class that does not involve loading (and presumably unloading) a real database for each test method? Are you using mock objects to represent the database connection? If so, are you required to pass the mock object into every method-under-test, and thus forcing t...

Do you write your unit tests first, after a bit of coding or not at all?

I was wondering when most people wrote their unit tests, if at all. I usually write tests after writing my initial code to make sure it works like its supposed to. I then fix what is broken. I have been pretty successful with this method but have been wondering if maybe switching to writing the test first would be advantageous. ...

Creating nunit tests without exporting them with the api

I'm new to unit testing using nunit (and Java development in general). When creating unit tests for private methods on classes, it looks as though the test file must be in the same package as the class being tested. What is the typical way of avoiding exporting the APIs of the unit tests? Can I make the classes/test methods package-pr...

Good Ruby/Rails testing tutorial?

Can someone recommend a good, up-to-date tutorial for a complete beginner on one of the major testing frameworks for Ruby, such as Rspec or Shoulda? I'd like to find something that doesn't assume any knowledge about the framework or about testing in general. For example, if the tutorial explained the distinction between TDD and BDD, that...

Relevance of Red Green Light Testing

I am starting, and loving, TDD, however wondering about the red green light concept. I do understand in theory the importance of ensuring you can fail a test before passing it. In practice, however, I am finding it somewhat a futile practice. I feel I can't properly write a failing or passing test without implementing the code I am inte...

Should I unit test methods which are inherited from super class?

I'm currently writing an implementation of a JDBC driver (yes, you read that correctly) in a TDD manner and while I have only finished class stubs at this point and only some minor functionality, it just occured to me that since Statement is a superclass for PreparedStatement which is a superclass for CallableStatement, what should I do ...

How can I deal with too Many Mock Expectations in unit tests?

I am writing unit tests for my presentation class in MVP pattern.But I am having trouble to write mock setup code. I have a presenter and when presenter's Load method called I want to test view should load class properties, table fields, data types,set presenter.... So When I have a different thing to do when presenter load always I ha...

Integration testing an external library?

I am using an external library in a java project but I am not sure how can I integration test it with my code. For example: Let us say I am using a string encryption library to encrypt passwords. Please enlighten. Thanks ...

What's the point of testing fake repositories?

I've been trying to push my mentallity when developing at home to be geared more towards TDD and a bit DDD. One thing I don't understand though is why you would create a fake repository to test against? I haven't really looked into it much but surely the idea of testing is to help decouple your code (giving you more flexability), trim ...

TDD - How much do you test?

I'm working on a new project and I'm using the repository pattern, I have my repository that pulls the data from the database and a "service" class which uses the repository and does all the business logic. something similar to the following; public class UserRepository : IUserRepository { public IQueryable<User> GetUsers() { ...

How to setup the Dojo Objective Harness test case structure for testing custom code?

I'm looking at using the Dojo Objective Harness (DOH) for testing some custom JavaScript code. To that end I've read the following article: http://www.ibm.com/developerworks/web/library/wa-aj-doh/index.html and I have a question about the test case structure. The example shows that your test case modules in the same parent directory ...

Can automated unit testing replace static type checking?

I've started to look into the whole unit testing/test-driven development idea, and the more I think about it, the more it seems to fill a similar role to static type checking. Both techniques provide a compile-time, rapid-response check for certain kinds of errors in your program. However, correct me if I'm wrong, but it seems that a uni...

MSTest Code Coverage

Is there a way to test code coverage within visual studio if I'm using MSTest? Or do I have to buy NCover? Is the NCover Enterprise worth the money or are the old betas good enough if Microsoft doesn't provide built in tools to do code coverage? EDIT: Description of VS Products and which ones include code coverage http://www.microsoft...