none
Unittest on robotics RRS feed

  • Question

  • Hello,

    I am working with VS2010 and Microsoft Robotics Studio 4.0. I tried to create a unittest for a service but I couldn't figure it out. I know how to write normal unittest but that won't do it for MSRDS. Does one know how to do this? Please provide a simple sample for it.

    Friday, September 27, 2013 9:13 AM

Answers

  • I asked around, and here is what we can suggest:

    1) Unit tests are generally very low-level, basic functionality tests.  Ideally you design all of your services so that the core business functionality is encapsulated in its own class or classes separate from the communication glue, and the RDS Service instantiates these classes as needed and uses them to do the work.  This encapsulation allows you to test the "business logic" separately from the Service "glue" and is a good design practice. It also allows you to change the "glue" should you ever decide to use something other than DSS for the communication. Writing unit tests for these separate business logic classes should be like for any other class. They will generally take something like a message as input and produce a response as output.  If you don't make this distinction, then you cannot truly unit-test the functionality...  it is entangled with the communication.

    2) When it does come to doing integration or end-to-end testing (different from unit testing) we have not found any way to use the Visual Studio unit test framework for this. Instead you will need to create your own "test harness" that includes "test services" that can be inserted into the service graph and act as monitors or data-injectors. 

    I wish I had a simpler answer...  maybe someone else out there in RDS land has a suggestion?

    Friday, September 27, 2013 8:05 PM

All replies

  • I asked around, and here is what we can suggest:

    1) Unit tests are generally very low-level, basic functionality tests.  Ideally you design all of your services so that the core business functionality is encapsulated in its own class or classes separate from the communication glue, and the RDS Service instantiates these classes as needed and uses them to do the work.  This encapsulation allows you to test the "business logic" separately from the Service "glue" and is a good design practice. It also allows you to change the "glue" should you ever decide to use something other than DSS for the communication. Writing unit tests for these separate business logic classes should be like for any other class. They will generally take something like a message as input and produce a response as output.  If you don't make this distinction, then you cannot truly unit-test the functionality...  it is entangled with the communication.

    2) When it does come to doing integration or end-to-end testing (different from unit testing) we have not found any way to use the Visual Studio unit test framework for this. Instead you will need to create your own "test harness" that includes "test services" that can be inserted into the service graph and act as monitors or data-injectors. 

    I wish I had a simpler answer...  maybe someone else out there in RDS land has a suggestion?

    Friday, September 27, 2013 8:05 PM
  • This looks the same as another post...  can I mark this one completed?
    • Proposed as answer by Gershon Parent Monday, September 30, 2013 5:51 PM
    Monday, September 30, 2013 5:50 PM