unit-testing

web service and nunit testing

I have created a console application that calls a method on a webservice. I have accessed the webservice and get the response back from the console application that I expect. When I create a separate test assembly and create some nunit tests which call the same method in the same way i get the following exception:- System.InvalidOperati...

Write stored procedures in Linq/Lambda (Unit-testable but performant stored procs). Possible???

I am creating a data source for reporting model (SQL Server Reporting Services). The reports requires a lot of joins and calculations (let's say, calculating financial parameters like money spent on this, that, amount A vs amount B)...all this involves subobjects. It makes a lot of sense to me to write unit tests for this code (i.e. wal...

Unit Testing: Creating a 'mock' request to simulate a MVC page request

Hi, How do I go about creating a mock request for my asp.net-mvc application for unit-testing? What options do I have? I am using FormsCollection in my Actions so I can simulate form input data also. ...

Why do Test::Unit testcases start up so slowly?

>rails -v Rails 1.2.6 >ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] When I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the "Loaded suite..."). What gives? >ruby test\unit\category_test.rb require File.dirname(__FILE__) + '/../test_helper' cla...

How can generate views in asp.net-mvc unit tests?

Im trying to generate views in unit tests but i can't get around the missing VirtualPathProvider. Most viewengines use the VirtualPathProviderViewEngine base class that gets the provider from the current HostingEnvironment. protected VirtualPathProvider VirtualPathProvider { get { if (_vpp == null) { _vpp = Hosti...

How do I mock the method GetValues() in System.Data.IDataReader?

How do I mock the method GetValues() in System.Data.IDataReader? This method changes the array of objects passed to it, so it can’t simply return a mocked value. private void UpdateItemPropertyValuesFromReader( object item, IDataReader reader ) { object[] fields = new object[ reader.FieldCount ]; reader.GetValues( fields ); //...

Is there a framework for running unit tests on Apache C modules?

Hi, I am about to make some changes to an existing Apache C module to fix some possible security flaws and general bad practices. However the functionality of the code must remain unchanged (except in cases where its fixing a bug). Standard regression testing stuff seems to be in order. I would like to know if anyone knows of a good wa...

How do you unit test?

I've read a little bit about unit testing and was wondering how YOU unit test. Apparently unit testing is supposed to break a program down into very small "units" and test functionality from there. But I'm wondering, is it enough to unit test a class? Or do you take it even further and unit test algorithms, formulas, etc.? Or do you ...

Unit testing with Entity Framework

I want to test my Entities that are built using Entity Framework. My concern is that using Entity Framework means directly working with data source. So any ideas how to unit testing Entity Framework based components? ...

How to unit test (in memory) entity framework?

As in the topic... I was thinking about something like "in memory changes". On recent blogs by Jaroslaw Kowalski i have found similar approach but i was thinking about sth much simpler ...

Starting ASP.NET Development Web Server (Cassini) as part of unit test setup?

I'm using WatiN, NUnit and ReSharper to run my ASP.NET unit tests inside Visual Studio. I'd like (if it's not already running) to start Cassini to run my tests against. Is this possible? How would I do it? ...

How do I activate JButton ActionListener inside code (unit testing purposes)?

Hi, I need to activate a JButton ActionListener within a JDialog so I can do some unit testing using JUnit. Basically I have this: public class MyDialog extends JDialog { public static int APPLY_OPTION= 1; protected int buttonpressed; protected JButton okButton; public MyDialog(Frame f) { super(f); okButt...

Handle Swing events in JUnit test

I have Swing java application with network communications to several "Players" that are represented as player objects, each with their own communication thread. The app has a "Team" object managing all player objects. Several UI components listen to events passed from the players through the Team object. In my design, the team object f...

What .NET language you use to write Unit Tests?

In the past I wrote most of my unit tests using C# even when the actual software development was in another .NET language (VB.NET, C++.NET etc.) but I could use VB to get the same results. I guess the only reason I use C# is because most of the examples in the internet are written in C#. I you use unit tests as part of .NET software dev...

Cruise Control and PHP projects

Hi, I'm looking for a complete solution to a automated "building" and testing of PHP application. I came across PhpUnderControl, a solution for running automated application builds created around Cruise Control. Unfortunately PhpUC is still in it's early stages of development and I can't get it to work on windows box. After few hours ...

Is running tests with JUnit 3.x vs JUnit 4.x still a best practice?

I haven't looked at this in a while, but if I recall correctly both ant and maven still rely on JUnit 3 for unit tests (as of maven 2.09 the default POM file still has JUnit 3.81). Does it still make sense to stick to JUnit 3 instead of using the latest and greatest? Any good reason I might be missing? ...

Unit test WPF Bindings

I am trying to unit test my WPF databindings using the test suit provided by Microsoft Team System. I would like to be able to test the bindings without showing the window because most of my tests will be for user controls and not actually on a window. Is this possible or is there a better way to do it? The code below works if I show ...

How do I do TDD efficiently with NHibernate?

It seams to me as most people write their tests against in-memory, in-process databases (like SQLite) when working with NHibernate, which is fine. I have this up and running but my first test (that uses NHibernate) always takes between 3-4 seconds to execute, next test runs much faster. I am using FluentNhibernate to do the mapping but ...

information on TAP and TDD for 'C'

I am precisely looking for the info like , TAP is for regression and TDD is for Unit Testing ... or are they mutually exclusive( no need to use both of them ) ? bonus for suggesting 'good' Unit Test Frame work for TDD in C (expecting to address good aspect as well :) ) finally cMockery (googles code) for Testing C code (not derived ...

Unit testing code that basically does persistence - Should I bother?

I am using an api which interacts with a db. This api has methods for querying, loading and saving elements to the db. I have written integration tests which do things like create a new instance, then check that when I do a query for that instance, the correct instance is found. This is all fine. I would like to have faster running...