Code I'm working on collects performance data (eg CPU usage) from the operating system. I'm wondering if I should bother to attempt to unit test this code. It seems that to unit test code, you need to design code that is isolated into units. My code is so closely tied to the OS though that if I isolated the code out that interacts with t...
A few quick searches discovered that I'm obviously not the first person to have the thought "Can I unit test my CSS?".
I'm wondering if anyone here has taken on CSS Unit Testing successfully? If you've tried and failed, or just have your own theories, please tell me why it (apparently) hasn't been done yet?
...
I've inherited a legacy web application that has no unit tests in it. I'd like to add some, but am at a loss of where to start. Should I add them to old code? Or just new code going forward? What if that code interacts with legacy code? What would you suggest?
...
I have just branched our Common Business Layer projects from the main to a new branch, and included them in a new solution. Everything compiles but when I run the unit tests I get the following error for every single test...
Unit Test Adapter threw exception: Unable to load one or more of the requested types. Retrieve the LoaderExcep...
I am unit testing a .NET application (.exe) that uses an app.config file to load configuration properties. The unit test application itself does not have an app.config file.
When I try to unit test a method that utilizes any of the configuration properties, they return null. I'm assuming this is because the unit test application is ...
Hey all.
I have CLI/MFC application and I would like to begin to learn how to unit test with it. I have VS2008 Pro. If possible, I would like to use the built in unit testing. Thanks for your input!
...
I used to have a Tests folders in my main project where a unit test had this line of code:
Foo foo = new Foo(Environment.CurrentDirectory + @"\XML\FooData.xml" );
I have an XML directory in the Foo project that has a FooData.xml
In the post build event of my projects i have the following line
copy "$(ProjectDir)Foo\Currencies.xml" "...
I have been hearing that with unit testing we can catch most of the bugs in the code and I really believe that this is true. But my question is in large projects where each class is dependent on many other classes how do you go about unit testing the class ? Stubbing out every other class doesn't make much sense because of both complexit...
I know how I use these terms, but I'm wondering if there are accepted definitions for faking, mocking, and stubbing for unit tests? How do you define these for your tests? Describe situations where you might use each.
Here is how I use them:
Fake: a class that implements an interface but contains fixed data and no logic. Simply retu...
Okay, I develop web applications in PHP and Javascript and a lot of times here on SO I have seen the word UNIT TEST passing by, but nowhere on the website have I been able to found a satisfactory answer to what exactly a UNIT TEST is.
So what are UNIT TESTs and should I, as a PHP and Javascript programmer, care, or are they only for 'r...
I am just learning about Unit Testing. I am using NUnit to build tests for a VB.NET project.
The project I'm working on is part of a framework which will be used by people who build ASP.NET websites. It includes a base class (which inherits System.Web.HttpApplication) that users of my framework will inherit their application class fro...
I'm implementing unit tests for a family of functions that all share a number of invariants. For example, calling the function with two matrices produce a matrix of known shape.
I would like to write unit tests to test the entire family of functions for this property, without having to write an individual test case for each function (pa...
Do you put unit tests in the same project for convenience or do you put them in a separate assembly?
If you put them in a separate assembly like we do, we end up with a number of extra projects in the solution. It's great for unit testing while coding but how do you release the application without all of these extra assemblies?
...
After using nunit for a long time, i've decided to test out Microsoft's built in testing framework.
At the beginning of my tests, I generally clean the database to get it into a state i can rely on for testing.
In my test setup, i delete all the data and insert fresh data for my tests.
Since starting to use the MS tests, i've noticed m...
I'm not brand new to the concept of unit testing but at the same time I've not yet mastered them either.
The one question that has been going through my head recently as I've been writing unit tests while writing my code using the TDD methodology is: to what level should I be testing?
Sometimes I wonder if I'm being excessive in the us...
I know that MSTest doens't support RowTest and similar tests.
What MSTests users do? How is it possible to live without RowTest support?
I've seen DataDriven test features but sounds like too much overhead, is there any 3rd patch or tool which allow me to do RowTest similar tests in MSTest ?
...
This is a follow-up to a previous question of mine.
In the previous question, methods were explored to implement what was essentially the same test over an entire family of functions, ensuring testing did not stop at the first function that failed.
My preferred solution used a metaclass to dynamically insert the tests into a unittest.T...
I'm using QUnit to test some JQuery, and I've got Watin to load up the test page and parse out the test results, but I'm wondering if there's a way to dynamically generate the tests from the page using the MS Test suite rather than having to write a Test function for each test?
I'm just trying to reduce the amount of code having to be w...
I am creating an application that will manage multiple instances of an external utility, supplying each with data and fetching results.
But as I am writing unit tests for the class I came upon a problem.
How do test that the target method actually starts a process (set via a property) when called?
I have tried:
Make the class execut...
I've been using moq to mock objects in my unit tests and I've seen on the site about moq that it is able to mock both classes and interfaces.
I had a discussion with one of my work mates the other day and they stated that there is never a reason to mock classes and I should only mock interfaces.
I didn't really have an answer to that.....