How to view documents using Visual Studio

View documents in Visual Studio with an amazing tool

Xpath Axes

A very useful trick for automation

Review: Spire.DataExport for .NET

A great tool for exporting data in .NET

How to install Arch Linux, step by step, for VMware Workstation (Part I)

First part of a installation tutorial for this beloved OS

How to setup a local repository in Ubuntu

The steps to have a local repo in Ubuntu

Wednesday, May 29, 2013

Video Game greatest soundtracks (according to Forbes)

Video Games nowadays needs investments of millions of dollars. In fact, a lot of video games are more expensive than movies. One remarkable effect of this huge investments are the quality of music.

I personally enjoy video games music since I was a child (even from the eternal Super Mario Bros. tunes). Of course, I'm not the only one. Nevertheless, when I see a "serious" publication as Forbes listing the best video games soundtracks, I can understand that the video games are no longer the devilish things I used to be warned about when I was younger. Step by step, video games are finding their place in our culture. Check the article here.

By the way, a disappointment was the exclusion of the work of Akira Yamaoka in the list. I think it is brilliant! You can listen some tracks here.

Sunday, May 26, 2013

Angry Birds Space free!!! (for a limited time)

Angry Birds is free for a week. Download it now!! Link here.

Saturday, May 25, 2013

How to use Coded UI for automated testing (Visual Studio 2012)

There is a tendency in the industry nowadays: Automation. When it's related to software testing, it basically means to automatize as much of the testing as possible. Manual testing will never disappear, but automation helps saving time and money. Of course, there are other uses for the automation techniques in general, but it depends on the creativity of the user.

When you automatize something, you generally will perform the following steps:

1. Open an application to be tested
2. Record the steps you want to automatize
3. Transform those steps into code in some programming language. For example, in this case, we will transform the recorded steps into C# code.
4. Modify the code according to what you need to test.

I'll use Notepad to make a simple example of can be done with Coded UI.

What I'm going to show you here is how to automatize some steps with Visual Studio. Unfortunately, as it happened before, the only Visual Studio version I have is in Spanish, but I think you can use this tutorial anyway. Let's begin.

  • Visual Studio 2012.  You can get the express version here.
  • A shortcut of Notepad in the desktop


1. Open Visual Studio
2. Create a new project. You can use the "New Project" link in the main screen:
3. In the let pane, select "Test". In the center pane, select "Coded UI test" (or something like that). You can check the following picture to get the idea. Don't forget to set a name for the project:
Now click Ok.
4. Now you will see the "Generate Code for Coded UI Test". It has 2 options: Record actions, edit UI map or add assertions and Use an existing action recording. Select "Record actions, edit UI map or add assertions". Click OK.

5. Visual Studio will be minimized. Now, you will see a little dialog like the one in the picture:
This a little console from where you will be able to record the steps for your application.
6. Minimize anything you are using and click on the record button: 
7. Now, perform these steps:

7.1 Open Notepad from the shortcut in the desktop
7.2 Write "Testools" in Notepad
7.3 Click the "Close" button
7.4 Click "Don't Save"

8. Click "Pause" in the little console. It's in the place where you clicked "Record".
9. Click on "Generate Code"
10. Type a method name. In this case, it will be "WriteTestoolsNotepad". As you can see, it is helpful to know something about object-oriented programing to use Coded UI. Click Add and Generate.
11. Wait a couple of seconds and click on "x" to close the little console. That will take you to Visual Studio again.
12. Now, as you can see in your code, there is a call to the "WriteTestoolsNotepad" method in the code:
This means that your steps has been recorded and turned into C# code. Now you can see you'r first test in action!
13. In the toolbar, go to Test>Windows>Test Explorer
14. The test explorer will be displayed. Now, press F6 to load the test methods (it can take a while...). In this case, only one will be displayed. Click on "Run all":
You'll see the steps you recorded be performed automatically. Cool! If everything went as expected, you should see the results from the test like this:
Just take into account that this example is not a complete test cases. We don't even know what we are testing. This is just an example of the use of Coded UI. I'll explain the correct use of this tool in future articles. Happy testing!