Sponsors

News

Jobping Laurent Kempé MVP JetBrains Academy Member Certified ScrumMaster

Contact

My status

View Laurent Kempé's profile on LinkedIn
XING
twitter
facebook


Xbox 360



Map

Locations of visitors to this page

.NET Dudes

Family

French .NET Dudes

Friends

Jobping

Links

Tech Head Brothers

Blog moved to www.laurentkempe.com

You can find my new blog on its own domain now, http://www.laurentkempe.com/

You might update your reader to use the new rss feed

After almost 7 years spent on weblogs.asp.net I decided that it was time to move my blog to it’s own location. On which I will continue to talk about technical interest I have but also about other things.

Sorry for the annoyance and I hope that you will continue to follow me!

VisualSvn, TortoiseSvn and relocating a working copy

Whenever you have to relocate your svn working copy because the svn server url or protocol as changed, you need to use TortoiseSvn relocate. If, like me, you use VisualSvn plugin then you would need to quit Visual Studio and come back to Windows Explorer and TortoiseSvn, right click your project folder then find Relocate command:

4311387612_f21c311484_o[1]

Type in the dialog which open the new url of the svn repository, then click Ok.

TortoiseSvn will then do it works and the next time you open Visual Studio you will have your working copy pointing to the new server.

Read the documentation on the following page:

If your repository has for some reason changed it's location (IP/URL). Maybe you're even stuck and can't commit and you don't want to checkout your working copy again from the new location and to move all your changed data back into the new working copy, TortoiseSVN → Relocate is the command you are looking for. It basically does very little: it scans all entries files in the .svn folder and changes the URL of the entries to the new value.

You may be surprised to find that TortoiseSVN contacts the repository as part of this operation. All it is doing is performing some simple checks to make sure that the new URL really does refer to the same repository as the existing working copy.

Warning

This is a very infrequently used operation. The relocate command isonly used if the URL of the repository root has changed. Possible reasons are:

  • The IP address of the server has changed.

  • The protocol has changed (e.g. http:// to https://).

  • The repository root path in the server setup has changed.

Put another way, you need to relocate when your working copy is referring to the same location in the same repository, but the repository itself has moved.

It does not apply if:

  • You want to move to a different Subversion repository. In that case you should perform a clean checkout from the new repository location.

  • You want to switch to a different branch or directory within the same repository. To do that you should use TortoiseSVN →Switch.... Read the section called “To Checkout or to Switch...” for more information.

If you use relocate in either of the cases above, it will corrupt your working copy and you will get many unexplainable error messages while updating, committing, etc. Once that has happened, the only fix is a fresh checkout.

Posted: Jan 28 2010, 12:04 PM by lkempe | with 4 comment(s)
Filed under:
NDepend v3 - now 100% integrated in Visual Studio

Patrick just announced on his blog the launch of the new NDepend v3. It is still in beta but very stable. I am testing it for a month now and enjoy very much it’s integration in Visual Studio 2008. I was using it and will continue to use it in our continuous integration server, TeamCity. But getting feedback right out of the developer environment is a very interesting feature.

Read more on Patrick’s blog post, “NDepend v3 is now 100% integrated in Visual Studio

Even on large code base, made of hundreds of thousands of lines of code and dozens of VS projects, Visual Studio is not noticeably slow down by the NDepend v3 addin.

VisualStudio 2010, 2008 and 2005

Simply put, what NDepend v2 does in the Continuous Integration/Build process, NDepend v3 does it live at development-time inside Visual Studio

Multi VS solutions wide-analysis and collaboration

Rich Code Search in VS

Multi CQL Query Edition in VS

Code visualization in VS

Continuous comparison with a base line in VS

Reflector disassembly’s comparison

Deep VS Integration

NDepend Session state preserved

ProgressCircleTooltip[1]

Well done Patrick!

White’s tip for your automated WPF functional tests

When you build automated WPF functional test using White in which you need to open a file through a Windows open file dialog, you will be confronted with the following issue. Windows open file dialog remember the last path with which you opened a file.

So you might have some unit tests that are green for a while which starts to be red for no apparent reasons.

The solution I came to is as this.

First I use Visual Studio, Copy to Output Directory, to copy the needed file to the output directoy in which your software will be started by the unit tests, e.g. for notValidVersionZip.zip

4309956698_b62daf51f5_o[1]

So now I am sure that the needed file is in the same path than the application. I then also need to be sure that when the application start the Windows open file dialog it points to this path. In the past implementation I was just using a filename and was lucky enough the path used by the Windows open file dialog was the correct one.

To get to the correct path is easy. We just navigate to the correct path using the Windows open file dialog in an automated way. The correct path is the path in which the application as been started, so you can get it like that:

  1. /// <summary>
  2. /// Gets the current path.
  3. /// </summary>
  4. /// <returns></returns>
  5. private static string GetCurrentPath()
  6. {
  7.     return Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
  8. }

We have the correct path and we still need to automate the Windows open file dialog to navigate to that path. We can do this like that:

  1. protected void Open(string filename)
  2. {
  3.     OpenButton.Click();
  4.  
  5.     var openModalWindow =
  6.         MainWindow.ModalWindow("Please choose a Zip file", InitializeOption.NoCache);
  7.     Assert.IsNotNull(openModalWindow);
  8.  
  9.     var splittedPath = GetCurrentPath().Split(new[] { '\\' });
  10.  
  11.     foreach (var pathPart in splittedPath)
  12.     {
  13.         openModalWindow.Enter(pathPart);
  14.         openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
  15.         openModalWindow.WaitWhileBusy();
  16.     }
  17.  
  18.     openModalWindow.Enter(filename);
  19.     openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
  20. }

Basically we split the path into it different path parts that White will enter into the dialog followed by a enter. Don’t forget to use the method WaitWhileBusy() after each enter, otherwise it will be too fast and sometime your test will not go to the correct path and then will not find the file.

Finally White enter the filename followed by enter and the file is opened.

Nice!

If you are using like me ReSharper to run your unit tests don’t forget to set it up to run tests from Project output folder.4309993844_8d9e828f8c_o[1]

Posted: Jan 27 2010, 09:24 PM by lkempe | with 1 comment(s)
Filed under: , ,
Automated WPF functional tests using White

I’d like to introduce a tool that I have added for a month or two in my toolset. This tool is White from ThoughtWorks. Here is the description of White:

White: Automate windows applications

White supports all rich client applications, which are Win32, WinForm, WPF and SWT (java).
It is .NET based and hence you wouldn't have use proprietary scripting language. You can use your favourite .NET language, IDE and tools for developing tests/automation programs.
White provides consistent object oriented API for all kinds of applications. Also it hides all the complexity of Microsoft's UIAutomation library and windows messages (on which it is based).
(While WHITE is completely ready to be used, the documentation is still work under progress. Please do point out the areas which needs documentation.)

When I found White with it’s version 0.19, I was a bit skeptical about the state of this piece of software. But it is really ready to be used.

By the way the latest version 0.19 of White supports also Silverlight.

I had the need to automate some functional tests of a WPF application that I am working on. When such an application is growing it becomes more and more difficult to do functional tests manually, so it needs automation.

So what I was searching for was something that would let me write unit tests in C# with NUnit which automate a WPF application. It is not that I don’t want to learn another language but I needed to be efficient so I preferred to use something I knew. And what I have found is White.

I have tested it with the RadRibbonBar for WPF of Telerik and it works just great. btw Thanks to Telerik for the offered license, which my company Innoveo Solutions also ordered now.

If you are starting with automated functional testing I recommend you to read the Functional Testing. It explains step by step how to write automated functional tests with White. The basic can be also used with another tool.

It is funny to see you application running without you clicking around.

I still need to have this run by our build server, TeamCity. I have currently not done any investigation on that point. I plan to have those tests running at least nightly, but I have to see how the unit tests could be started on an environment with a desktop.

Posted: Jan 27 2010, 08:50 PM by lkempe | with 5 comment(s)
Filed under: , ,
The beauty of C# and Linq

Today I faced the following challenge to solve: return all possible combinations of three source collections.

We are using C# and with Linq it was just so easy.

  1. public List<string> Contexts
  2. {
  3.     get
  4.     {
  5.         var result = from u in SelectedUseCases
  6.                      from c in SelectedChannels
  7.                      from up in SelectedUserProfiles
  8.                      select string.Format("{0}-{1}-{2}", u.Value, c.Value, up.Value);
  9.  
  10.         return result.ToList();
  11.     }
  12. }

Simple and beautiful!

Posted: Jan 25 2010, 09:57 PM by lkempe | with 4 comment(s)
Filed under: ,
ClickOnce ISignedCode::Sign returned error: 0x80880253

Tonight we got the following issue on our TeamCity build server which produce different ClickOnce setups :

c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3652, 9): error MSB3482: An error occurred while signing: Failed to sign ..\..\Tests\Output\bin\DeployClickOnce\app.publish\setup.exe
SignTool Error: ISignedCode::Sign returned error: 0x80880253
    The signer's certificate is not valid for signing.
SignTool Error: An error occurred while attempting to sign: ..\..\Tests\Output\bin\DeployClickOnce\app.publish\setup.exe

Checking the certificate used by our project I found that the expiration date was yesterday:

4267117780_617c4d5071_o[1]

So I had first to create a new test certificate.

Then I had to re-install the certificate on the server, as described in “ClickOnce certificate and TeamCity”. Before installing I had to remove the old one using:

> Psexec.exe -i -s cmd.exe

then running

> mmc

and removing by hand the old certifcate.

Review of 2009 blog posts

Find here a list of all my 38 posts for 2009! In the bold, the posts which got most traffic.

January

February

March

April

May

July

August

September

October

November

December

Limit issues with Eclipse when using VisualSVN/TortoiseSVN

In some rare case I have to use Eclipse configured to access our Innoveo Solutions svn server. I also for sure have Visual Studio 2008 with VisualSvn installed which install TortoiseSvn.

Today I faced the following crazy issue, from a file browse window opened through Eclipse, I saw that one file was modified so I did from that file browse window a svn revert using TortoiseSvn which ended to a crazy situation in Eclipse. It was totally messed up.

So to avoid this, I configured TortoiseSvn Exclude Paths not to show me this folder and subfolder with icon overlays:

4253062219_8a93a90c4d_o[1]

I hope this will save me from those crazy situations!

Posted: Jan 07 2010, 01:56 PM by lkempe | with no comments
Filed under:
Visual Studio 2008 little tip

Tonight I found a little tip that you might already know but for me it was the first time I realize that.

When you want to open the properties of a project in Visual Studio 2008, in the past I was doing a right click on the project then I was searching for couple of seconds the entry properties

4251657661_0caae12aa4_o[1]

And since today I do it slightly differently I expand the project and double click on the Properties folder which open the Properties of the project, obvious (at least when you know it ;)

4251663871_e39685f837_o[1]

Posted: Jan 06 2010, 11:27 PM by lkempe | with 3 comment(s)
Filed under:
More Posts Next page »