Compact Test

Compact Test
How to do NUnit tests with .NET compact framework ?

I want to do NUnit test on compact framework because the tests need to be run on a WindowsCE device ( the application depends heavily on SQLCE, which can not be emulated on desktop ).

Hi, for whitebox testing it is clear that it is dealing code. You get ugly testing raw code :) It will get ugly :> But it is nice that your thinking of doing it since many people don’t do it. Good software practicing, is good for the world!

Clearly the best Whitebox tool out there is CSUINT. It is similar to the other test suites for other programming languages.

Take a look at http://www.csunit.org/ There are many tutorials on that site as well.

Good Luck

PS: This tool works like the popular JUNIT!

For the good real life example :)

using System;
using csUnit;
using MyProject;
// MyProject is where the class to be tested exists.

namespace example {
///


/// Summary description for FooTests.
///

[TestFixture]
public class FooTests() {
public FooTests() {
// nothing to do here
}
///
/// Test the set and get methods of the MyClass.Value property
///

[Test]
public void TestValueProperty() {
MyClass obj = new MyClass();
Assert.Equals(0, obj.Value);
obj.Value = 25;
Assert.Equals(25, obj.Value);
}
}
}

using System;

namespace MyProject {
///


/// This is the class to be tested..
///

public class MyClass() {
private int _ival = 0;
public void MyClass() {
_ival = 25;
}
public int Value
{
get
{
return(_ival);
}
set
{
_ival = value;
}
}
}
}

As you see I am creating an object and testing it if the value is correct:) As you see it is straight forward by using the Assertion Calls. I am testing if the object value is 0 and then 25 which are both true.

You do that for each function your testing like if we have getCarInfo, I make a stub to visuallize all the dependencies and then test that function like string car = getCarInfo(1); Assert.Equals(“sedan”, car); So if my function returns my expected result, then I am correct else there is a bug.

Good Luck on your testing! Takes a bit of time to do it :>

But say your project depends on libraries like SQLCE, then you would need to create a MOCK that replicates the functionality of SQLCE so you don’t need to use that library. So if some classes depend on that library, you can instead Create a MOCK class and use the method stubs to ensure your testing correctness is valid.

http://msdn.microsoft.com/msdnmag/issues/04/10/NMock/


Cuisinart GR-4N 5-in-1 Griddler


Cuisinart GR-4N 5-in-1 Griddler


$185.00


The Cuisinart(tm) Griddler makes “multifunctional” an understatement! Make perfect panini… plus! With four separate cooking options, it can handle everything from pancakes to sausages to grilled cheese to steaks, hamburgers and panini. It helps you prepare more servings of more kinds of food in less time, so you can cook for a crowd — no one has to wait!Simply change the cooking plates and adju…

Progressive International HGT-11 Folding Mandoline Slicer


Progressive International HGT-11 Folding Mandoline Slicer


$15.75


Slice and julienne vegetables evenly into thick or thin slices with ease using this folding mandoline slicer from Progressive. This versatile and efficient gadget uses three double sided cutting blades to provide six cutting option; thin slice, super thin julienne, medium slice, thin julienne, thick slice, and thick julienne. The blades are made of stainless steel for edge retention and efficiency…

Cuisinart CPB-300 SmartPower 15-Piece Compact Portable Blending/Chopping System


Cuisinart CPB-300 SmartPower 15-Piece Compact Portable Blending/Chopping System



Meet the Cuisinart SmartPower Compact Portable Blender – the compact powerhouse that does it all! Use the streamline blending cup to make smoothies in a flash! Mince herbs in the chopper cup and whip up custom drinks right in the “To-Go” cups – we’ve included four of them so everyone can have their favorite! Designed of fit anywhere, the Compact Portable Blender delivers big blender performance wi…


Carpenters Gold (CD) [2 Discs]


Carpenters Gold (CD) [2 Discs]


$10.85


All products are BRAND NEW and factory sealed. Fast shipping and 100% Satisfaction Guaranteed….

Every Great Motown Hit of Marvin Gaye


Every Great Motown Hit of Marvin Gaye


$7.23


All products are BRAND NEW and factory sealed. Fast shipping and 100% Satisfaction Guaranteed….

Decade


Decade


$10.70


The first stop for anybody new to Neil Young’s music, this 34-song set (originally released in 1977) traces his growth from Buffalo Springfield and Crosby, Stills, Nash & Young to Crazy Horse to his Harvest band, the Stray Gators. The album defined Young to rock radio the way Hot Rocks determined which Rolling Stones songs would become classics, but this is more than a quickie greatest-hits collec…

Philips Sonicare HX6013/90 ProResults Brush Head Standard


Philips Sonicare HX6013/90 ProResults Brush Head Standard




Philips Sonicare E-Series Replacement Brush Head


Philips Sonicare E-Series Replacement Brush Head



Replacement Brush Head for all SONICARE Elite & Essence model dental care products / 3 Brush Heads per package…


Philips Sonicare HX6972/10 FlexCare Plus Rechargeable Electric Toothbrush


Philips Sonicare HX6972/10 FlexCare Plus Rechargeable Electric Toothbrush


$126.95


Featuring five brushing modes, the Philips Sonicare FlexCare+ is your solution for complete oral care. Utilizing patented Sonic technology, this rechargeable toothbrush removes plaque deep between teeth and along the gum line to decrease your risk of gingivitis and improve your gum health in two weeks. For convenience, backlighting indicates your selected brushing mode, and a UV brush-head sanitiz…

Fiio E3 Headphone Amp


Fiio E3 Headphone Amp


$2.51


The E3 Portable Headphone Amplifier from Fiio is a compact and portable headphone amplifier that allows you to increase the play time of your music player and improve the audio quality. It also has a bass boost function for enhanced bass. The amplifier has standard 3.5mm input and output connectors, providing compatibility with a variety of headphones and music players. Simply place the amplifier …


Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Post a Comment