unit-testing

Writing Unit tests for a class that references UI controls

I have an abstract class that a User control inherits from, that I would like to write unit tests for. I understand I need to create a mock class to be able to test abstract classes. The abstract class has references to UI controls (ex: a base method that has web control as an argument). My question is, how would I write unit tests to an...

Unit testing for exceptions in Python constructor

Hello, I'm just a beginner in Python and programming in general, and have some questions about the unittest module. I have a class, and in the __init__ method I am doing some assertions to check for bad arguments. I would like to create a unittest which checks for such AssertionError when creating new instances. In the unittest modul...

Testing methods that make http requests

I have some methods in my app that make http requests. Is there a good way to simulate network failures and bad responses for the unit tests? ...

Is it fair to say that high code coverage and high performance not needed for a well designed unit test?

In designing unit tests, from what I've read you should try to stick to these principles: Isolate your tests from each other Test only a single behavior at a time Make sure the test is repeatable On the other hand, these features do not always seem to correlate with a good test: High code coverage High performance Is this a fai...

Writing tests for Django's admin actions

I'm using Django 1.1 beta and hoping to use admin actions. I have to write unit tests for those, but I don't get it how to write tests for them. For normal view handler functions, I can use Django's TestClient to simulate http request/response, but how should it be done with admin actions? ...

Proper submission of forms with autogenerated controls

Based on: http://stackoverflow.com/questions/658458/mvc-html-checkbox-and-form-submit-issue Let's consider following example. View: <% using(Html.BeginForm("Retrieve", "Home")) %> <% { %> <%foreach (var app in newApps) { %> <tr> <td><%=Html.CheckBox(""+app.ApplicationId )%></td> </tr> ...

AD Provider Membership.GetUser() cause error saying: "The parameter 'username' must not be empty."

Using the ActiveDirectory Provider, when i'm execute the Membershhip.GetUser() i got the following error massage saying: "The parameter 'username' must not be empty.". Here is the membership configuration: <membership defaultProvider="AspNetActiveDirectoryMembershipProvider" > <providers> <clear/> <add name="AspNetActiveDirec...

What unit testing tools are being used to test Rhapsody generated C++ code?

I am using the Rhapsody modeling tool to design multi-threaded C++ embedded applications. What unit testing approaches and tools are currently being employed for unit and functional test? Is anybody using the companion unit testing tool for Rhapsody (Test Conductor)? ...

Making VS2008 tests into NUnit tests

I have been told that the automatically generated tests in VS2008 can be made compatible with NUnit just by adding #if !NUNIT using Microsoft.VisualStudio.TestTools.UnitTesting; #else using NUnit.Framework; using TestClass = NUnit.Framework.TestFixtureAttribute; using TestMethod = NUnit.Framework.TestAttribute; using TestInitia...

Using CppUnit for memory leak detection

Is anyone aware of extensions to CppUnit that can be used to make assertions on a test by test basis concerning memory leaks. i.e. CPPUNIT_ASSERT_NO_LEAKS()? Essentially, I want to be able to fail specific tests when the execution of the test results in leaked memory. ...

Mbunit and selenium

Hi, Can anyone tell me how get mbunit to run more than one test at a time without it setting up and tearing down after every test? Currently I'm using selenium for UI testing and need to run the tests consecutively do a login page. Thanks in advance, cb ...

The Purpose of Mocking

What is the purpose of mocking? I have been following some ASP.NET MVC tutorials that use NUnit for testing and Moq for mocking. I am a little unclear about the mocking part of it though. ...

Is it possible to display progress during the execution of a Visual Studio TestMethod?

Is there a way I can show the progress of a single TestMethod In Visual Studio 2008 ? Within a set of unit tests, I have a single TestMethod that runs for a very, very long time - normally it will take between 30 and 60 minutes. I've set the Timeout using the [Timeout] attribute, no problem there. But I'd like to be able to get a visu...

Is there a unit testing framework for testing PowerShell with PowerShell scripts?

I am lookin for a unit testing framework of type xUnit that lets me test PowerShell functions with PowerShell scripts. ...

Do I need to test helper/setup methods?

So I have a helper method that looks something like the following: private D GetInstanceOfD(string param1, int param2) { A a = new A(); B a = new B(); C c = new C(a,b, param1); return new D(c, param2); } It's just a convenient helper method for which I can call to grab a particular object that I need rather then to re...

How to integration/unit test software hardware interfaces

I'm working on a small fun projects that builds a robot. We as the programmers are working parallel to the people building the robot. So it is very often the case that we are trying to run changed software and the builders have changed the hardware. If the software tests are not running it is always a hard thing to figure out if the sof...

Mocking a 3rd Party class

I would like to mock a class (i.e. with RhinoMocks) for which I don't have access to the code for (like say ManagementObject or ManagementObjectCollection) and for which methods/properties I am interested in isn't virtual isn't defined in an interface which the class implements The way that I have been getting around this is to imple...

Writing unit test for persistent data creation and deletion

When writing a test for persistently stored data, I come up with a test along the lines of: [TestMethod] public void DoCreateDeleteTest() { PersistentDataStore pds = new PersistentDataStore(); bool createSuccess = pds.Save("id", "payload"); Assert.AreEqual(true, createSuccess); bool deleteSuccess = pds.Delete("id"); ...

Can we unit test View ('V') of MVC?

Duplicate: Unit Testing the Views? Is there any way to unit test View? I am sure that we can test Model & Controller but don't know how to unit test View? Is that worth testing View? ...

Unable to set TestContext property

I have a visual studio 2008 Unit test and I'm getting the following runtime error: Unable to set TestContext property for the class JMPS.PlannerSuite.DataServices.MyUnitTest. Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft....