Fernando Machado Píriz's Blog

Posts about digital transformation, enterprise architecture and related topics

Archive for May 2010

Do you usually give presentations? Check this out

with 13 comments

For end users: Giving a Presentation is a simple application to change certain setting while delivering a presentation, e.g., hide desktop icons, disable screensaver, close selected programs, etc. Changes are reverted back when presentation ends. Initially built to show how to use certain technologies, it turned out to be useful by itself.

Watch this video to see Giving a Presentation in action:

If you want to try Giving a Presentation for youself, you can download installation bits from Codeplex.

For developers: Giving a Presentation is a WPF application sample created in C# that I use when blogging about Managed Extensibility Framework, Dependency Injection and Inversion of Control, etc. It demonstrates how an extensible application can be built as a container of component parts.

In this sample application, the container is the main window, plus the tab control on it. The tab control has just a Default tab and an About tab. The Default tab is initially empty; it will be dynamically filled by component parts.

clip_image002

The About tab shows typical information about application version, etc.

clip_image003

Component parts need to fulfill three requisites:

  1. Should implement an interface GivingAPresentation.Common.Contract.
  2. Should the decorated with the System.ComponentModel.Composition’s Export attribute.
  3. Should be deployed in an assembly in the same folder as the container.

The Managed Extensibility Framework and the MainWindow of the application will do the rest. The former will load instances of all exported types implementing the mentioned required interface in a list. The later will take the instances in the list and add the controls to the appropriate tab in the control tab.

Until now, I have created three component parts, to solve some of the typical problems that appear when giving a presentation:

  • Hide desktop icons. Usually you place working documents in your desktop. Some of these documents are private and you don’t want your audience see them before you start delivering a presentation. Use this feature to hide your desktop icons during a presentation and unhide them at the end
  • Disable screen saver. You may have your screen saver configured to start after certain time of inactivity. If you spend some time in a single slide during a presentation, your screen saver can interrupt your presentation. Use this feature to disable your screen saver during a presentation and enable it back at the end.
  • Close programs. Some programs pop up notification messages, e.g., mail or instant messaging clients when messages arrive. Despite of the interruption, the content of the notification might be inappropriate to be seen by your audience during a presentation. Use this feature to close selected programs during a presentation and open them back at the end.

Watch this video to see how these parts effectively extend the container:

You can download the source code also from Codeplex.

Give it a try. Hate it? Love it? Let me know.

Intellitrace in Visual Studio 2010 and Team Foundation Server 2010

with one comment

This is the seventh (and latest) post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

Certain bugs can be reproduced only if code is executed under certain conditions. If developers can’t recreate such conditions in their developing environment, it’s very unlikely for them to find these bugs. Visual Studio 2010 and Team Foundation Server 2010 can record events and calls during the execution of tests by using Intellitrace. Developers can later debug code reproducing those recorded Intellitrace files, like if they were using a VCR: they can go back and forward in the call stack, analyze parameters and result values, etc., even if their environment is completely different from the one where the Intellitrace file was recorded.

You can also download the video.

Written by fernandomachadopiriz

May 24, 2010 at 7:40 pm

Including tests in builds with Team Foundation Server 2010

with one comment

This is the sixth post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

Just because code compiles, we can’t be sure it’s bug-free. Only when all test cases passed, we can have certain degree of confidence, depending on how good tests are. Team Foundation Server 2010 easily allows adding tests cases execution to the build process, automatically generating bugs in the work items repository for failed tests.

You can also download the video.

More videos coming soon… keep tuned!

Written by fernandomachadopiriz

May 24, 2010 at 7:29 pm

Test Impact Analysis with Visual Studio 2010

with one comment

This is the fifth post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

Every time you modify your code, you need to run all tests cases again, to ensure no bugs were introduced in previously bug-free code; this is called regression testing. When the number of tests grows, the time to run all test gets longer. With test impact analysis, Visual Studio selects the minimal set of tests to cover modified code, optimizing the time required to do regression testing. In this video you will see a modification in the Subtract method of the Calculator class, and how Visual Studio selects the unit test that tests that method.

You can also download the video.

More videos coming soon… keep tuned!

Written by fernandomachadopiriz

May 24, 2010 at 7:24 pm

Using Pex and Contracts to generate unit tests in Visual Studio 2010 and C# 4.0

with one comment

This is the fourth post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

In a previous post I showed how to use Pex to automatically generate unit tests with high code coverage.

Contracts is a tool from Microsoft Research for Visual Studio implementing design by contract for the .NET Framework. Using Contracts, Pex generates better test cases. To get more details on how to use Pex and Contracts together, read this post.

In this video you will see how to add a precondition to a Factorial method of a Calculator class, and how Pex generates new test cases for this method.

You can also download the video.

More videos coming soon… keep tuned!

Written by fernandomachadopiriz

May 24, 2010 at 6:56 pm

Unit Tests generation with Pex using Visual Studio 2010 and C# 4.0

with 4 comments

This is the third post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

In the first post I showed how Visual Studio allows test driven development and in the second post how to automatically generate test cases from code.

Pex is a tool created by Microsoft Research that integrates into Visual Studio and automatically generates parameterized unit tests from code. In addition, Pex analyzes code under test and automatically generates test cases with high code coverage. In this video you will see how to create a unit test for a Factorial method of a Calculator class using Pex.

You can find more details about Pex, including sample code, in this post.

Written by fernandomachadopiriz

May 19, 2010 at 12:55 am

Unit Tests Generation with Visual Studio 2010 and C# 4.0

with 2 comments

This is the second post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

In the first post I showed how Visual Studio allows test driven development.

Visual Studio also allows automatic generation of unit tests skeletons from code under test. In this video you will see how to create a unit test for the Subtract method of a Calculator class using Visual Studio.

You can also download the video.

More videos coming soon… keep tuned!

Written by fernandomachadopiriz

May 15, 2010 at 3:50 am