Setting up Unit Test for TDD RRS feed

  • Question

  • Hello,

    I have a new requirement for some coding that is pretty straight forward...however I want to resist the urge for the same old stuff. Since the coding itself is easy what I'd like to do is begin a new standard of test drive development. This is where my difficulty lies. I am fairly comfortable writing a unit test in VS2010 Ult. but I have always written them after the method etc. to be tested was complete. This time I am coming from the other direction and having some trouble shifting the brain around and was hoping a few of you might help me break the old habit.

    The scenario is for one method (hopefully after one example I won't need more). This method needs to goto the active directory and retrieve all the groups and return them in a collection object of some sort. So how would I write my test case for this situation. I mean all I can really setup / assert is that a valid object gets returned. There is no way....without alot of extra effort...to know if the object actually has any data.

    So my unit test would just check for a collection object and pass. Again the idea is to write all my test first then write the method.


    Thanks for the guidance / help


    Monday, October 3, 2011 8:32 PM

All replies

  • Hello,

    Based on your description, this issue is about unit tests, so I will move it to Visual Studio Unit Testing forum, there you will get better support with engineers who familiar with it. Thanks for your understanding.


    Jack Zhai[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 4, 2011 8:06 AM

    Sounds like you are getting tied up with two semi opposing paradigms

    1. Testing Boundary Conditions

    2. Unit Tests that walk through Functional requirements

    For testing boundary conditions sounds like you are already on your way i.e. is it a valid object, does the collection have any objects if i get a null for the collection do i pass it back the first Collection of objects etc etc


    For Functional testing take a look at using FIT style methodologies with data binding http://en.wikipedia.org/wiki/Framework_for_Integrated_Test

    This way you can write test for things like object name compliance -without knowing the rules.




    Tuesday, October 18, 2011 1:34 AM
  • Doesn't VS2010 have a Fit methodology built in as part of the team suite? The question shows my rookie level of experience as I just read the wiki and thought I remembered VS & TFS having similiar capability?

    Thursday, October 20, 2011 1:23 PM