lördag, maj 17, 2008

NUnit runners with memory leak, and the solution

I found amazingly few references to people having problem with the NUnit test runners. We came to a point where the the NUnit test runners consumed over one gigabyte of memory and the same tests run from Resharpers test runner from inside Visual Studio would only consume about 250 megabyte of memory. I also found that the memory was not released between assemblies if you run a NUnit project file with multiple assemblies.

The problem was that a reference to each TestFixture decorated class was kept in the result even if it was unnecessary. Or to be more specific, the Fixture part of the result released it's reference to the tested Fixture class after TestFixtureTearDown, but the TestMethod in the result kept a reference to the very same Fixture...To find out about this I used a nice memory profiler, SciTech's .NET Memory Profiler

I posted a patch to the NUnit project on SourceForge. With this patch the nunit-console test runner use about the same amount of memory as the Resharper one, and I suppose this would be the case for the GUI one too, since this was a change in the core.

måndag, februari 25, 2008

Nice, smart and simple GUI testing

If you would like to test your windows GUI, try this Test Automation Fx.
You will get a new project in Visual Studio 2005 and 2008 and a designer to create your test project.
Then you record some clicks in your application to test. The designer generates C# or VB.NET code.
You can run the test to verify that your application behaves ;o)
It's nice that the output is .NET code so we can make adjustment if we need to. And even better, the recorded clicks doesn't only use stupid coordinates, but it identifies and finds buttons by name :o) So it could handle some changes without breaking the tests.
It works for both native and .NET applications.
It's a beta, but definitely worth looking at.

tisdag, januari 08, 2008

The old find in files error

Sometimes when I try FindInFiles in Visual Studio, I can get this error:
"No files were found to look in.Find was stopped in progress." in Visual Studio 2003, 2005 and now also in 2008
...the solution is to press Control + Scroll Lock.

I used to believe VisualAssist had something to do with it, but in VS 2008 I only use ReSharper, so I suppose Visual Studio itself is the problem?

onsdag, november 07, 2007

Switch between VS 2005 and VS 2008

I have made two small scripts that make it possible to develop using Visual Studio 2008 Beta 2 in a group using Visual Studio 2005.
And I'm sure these scrips could be very usefull if you want to make some other batch search replace on some files.

Surely my scrips don't cover all solution files but I'm sure you could modify them to cover your solutions.
As a base I use RxFind a regular expression search and replace, command line tool I found at CodePlex. To make it more usefull for this case I made a couple of small modifications.
I added the possiblity to take the search and replace expressions from an input file. This makes it easier to handle line breaks and "-characters in the expressions. When you avoid a few of the escape characters, it is much easier to read.

Use it like this.
  • Modify the file name and path in the first rows of the batch files.
  • Open your Visual Studio 2005 solution that should be under version control., in Visual Studio 2008 (Beta 2)
  • Let the conversion wizard do it's job.
  • Let your version control system show which files where modified
  • Try to run: "first time to2005.bat"
  • In the ideal world the solution should now not contain any modifications and it should be possible to open it in VS 2005 like before.
  • Run to2008.bat, it should now be possible to open the solution in VS 2008.
  • Run to2005.bat, if there are some modifications you want to commit, do so.
Runing this back and forth, I found a few small changes that I wanted to do in the project files. Changes that should be there in both the 2005 and the 2008 version of the files.

* If my script and your modifications work you should be able to work like this, using subversion/cvs terminology:

10 Checkout
15 run to2008.bat
20 Use the project in VS 2008
30 Make updates and so on
40 Run to2005.bat build and run the tests (I do this from the command line)
50 commit
60 Goto 15 ;o)

BTW The script are made for C# but could probably be modified for VB very easily, if there are some real VB-hacker out there...
If you have spaces in your solution file name or in the path where you put your tool, you would have to add a few "" in the batch file, but since i didn't need it. I leave it as an exercise for the reader.
One of the benefits I get out of this is that I can avoid conflicts between my favorite VS add in for C++(Visual Assist) which I use in VS 2005 and my favorite/current VS add in for C# (ReSharper) that I use in VS 2008.

Download scripts

Download updated source for RxFind

lördag, oktober 06, 2007

Silverlight

I rebuilt my CCTray for XPS with the latest code from subversion so now it works connecting through .NET remoting (original CCTray). It should use much less of the continous integration server resources than if you and all of you co-developers connect through http. Uppdate: New .NET XPS LightFX SDK

And I would like to mention that me and Truls will hold a Silverlight seminar in Göteborg, Linköping and Stockholm November 8 and 9. We have already done it twice in Malmö. See Dotway.se for more info.

And BTW don't miss Øredev

onsdag, maj 23, 2007

Update for CCTray for XPS

I found a little bug in the last version of my CCTray version for XPS. The LEDs were shut off during build. So I updated the files. You can download them from the same place:New .NET XPS LightFX SDK

fredag, maj 18, 2007

New .NET XPS LightFX SDK

Dell has released a new version of their XPS LightFX SDK. This version includes different dll's for Windows XP / Vista and their 32- and 64-bit versions. I have improved my managed wrapper, to support not only the SetEffect function, but also SetLEDSettings. I didn't care about backward compatibility, but changed the way you use the wrapper to be more simple.

This XPS thing is a Dell laptop model, I use a XPS M1710.

If you run the LedsExample program please copy the correct version of GamingSDK.dll to the folder, I added the Vista 32-bit version.

Download my wrapper: .NET XPS LightFX SDK

I made a simple hard coded version of CCTray(binary), which shows the summary build status on the XPS LED's. My XPS for CCTray patch(source)

Howto use the managed wrapper:
using Björn.Carlsson.XPSLeds;
namespace Leds
{
public partial class Form1 : Form
{
XPSLeds m_XPSLeds;
LED_USER_SETTINGS m_Settings;

public Form1()
{
InitializeComponent();
m_XPSLeds = new XPSLeds();
FormClosing += Form1_FormClosing;
}

void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
m_XPSLeds.Close();
}


private void btnSet_Click(object sender, EventArgs e)
{
m_Settings.Intensity = LED_INTENSITY.MAX;
m_Settings.Zone1 = LED_COLOR.KUNZITE;
m_Settings.Zone2 = LED_COLOR.PERIDOT;
m_Settings.Zone3 = LED_COLOR.TANZANITE;
m_Settings.ColorTouchPad = LED_COLOR_TOUCHPAD.RUBY;

m_XPSLeds.SetLEDSettings(m_Settings, false);
}
}