Howto: do basic things using ProjectWhite/White

December 16, 2009

Howto:
- launch an application
- navigate into a submenu
- get a hold of a MDIChild-window.


Public Class Test1

Private Const path As String = "C:\Path\myprogram.exe"

Public Sub TestMethod1()
Dim application As Application = application.Launch(path)

//Find the form
Dim main_window = application.GetWindow("name of window", InitializeOption.NoCache)
Assert.IsNotNull(main_window)

//Find the Menubar and its choices
Dim menu As MenuItems.Menu = window.MenuBar.MenuItem("Menu choice")
menu.Click()
Dim openSubMenuChoice = menu.SubMenu("Submenu choice")
openSubMenuChoice.Click()

//Find the MDIChild-window
Dim child_window = main_window.MdiChild(SearchCriteria.ByControlType(ControlType.Window))
Assert.IsNotNull(child_window)

application.Kill()
End Sub
End Class

Howto: Display code in wordpress

December 15, 2009

I’ve been wanting to add some code examples but the difficulty of working with code in the wordpress editor has made me shy away from it.

Until I saw: http://en.support.wordpress.com/code/posting-source-code/

That was a lot easier than I imagined.


public class hello(){

int a;
int b;
a= a+b;

}

Where does quality come from?

December 14, 2009

At work I was asked, together with a colleague, to come up with a plan on how to improve/introduce automated testing on our two systems.

It didn’t take us long to identify that integration testing was the way to go. We presented that track. And we were met with questions such as “And how are you going to measure the amount of defects we have?”

Well, would the quality of our systems improve if we measured the amount of defects they had? Would it tell us anything more than the amount of faults they used to have? (Or still have if the mentality is to tolerate and not fix the bugs)

Our plan was completely different.

Quality is something that you build into the system and testing is a tool that can help keep focus on it.

People are fond of TDD because the quality of the code can improve when you use it. It helps you keep track of the intent of your code, make it more structured and hopefully keep the complexity down.

In the same way, by using BDD and integration testing, you can keep track on the goal of the system. What business value does your code add? Who will use it? What is the desired effect?

Even though they are testing techniques, they are also development tools. And an interesting part in introducing quality.


The window is opened

December 10, 2009

I didn’t renew my contract for my part-time job after the end of this month. I really want to finish my master’s thesis and now I’ll be able to do it full time.

So, the window is opened. I’ll be done in the beginning of march, and I’ll need a job!

About me:
- I believe in agile methods
- I feel good when I TDD
- I own a xkcd t-shirt
- I really know how to sell myself

(“The window is opened” is a reference to HIMYM (S05E10). My favorite sitcom.)


“Has software development gotten too complex?”

December 6, 2009

While doing my cleaning duty at our daycare I finally got around to listen to the .Net Rocks panel discussion on the topic “Has software development gotten too complex?”

The first thing that hit me was the fact that a lot of the panel members and the audience argued that there were too many tools and too many options. I understand how this can be perceived as an issue but it seems like an odd argument to me. What would be the solution to such a problem? Putting a restriction on the amount of tools that people are allowed to develop?

There are a lot of tools out there and picking the right one might be hard. But the truth is that you don’t need them all to produce good software. The problem might be that people are feeling an obligation to use as many tools as possible, or tools that are too complex in themselves for a particular problem.

The show raised some other thoughts as well. We’ll see if I get them down “on paper”.


Howto: add logging to White (continued)

November 20, 2009

I wrote a while back about how I managed to add logging with log4net to my ProjectWhite tests in Visual Studio. However, after being forced to move my source code it suddenly didn’t work anymore eventhough I followed my amazing instructions. After trying a whole bunch of things out, one of them worked.

For log4net to work, the log4net.config file needs to be copied into the TestResult folder created by Visual Studios testrunner. In order to achieve this, enter the “Test” menu in VS, select “Edit Test Run Configurations”, “Deployment” and there, add your log4net.config file.

This made things work for me.

Note: I’m using the built-in testrunner in Visual Studio to drive my tests and not NUnit right now.
Note2: The first thing I did was setting it up as I did in my previous post, I haven’t tried to see if just adding the file to deployment is enough, it might not be.


Confirmation

November 18, 2009

Lately I’ve been receiving confirmation that the title I chose for my blog really is something that want to aspire to.

First, a talk with my colleague M. I wanted to know what the big deal with releases is. Since I keep hearing about release configuration and the company that I work at has hired a release manager it seems to be something very complicated. The manager of our IT departement tried to assure me that adding configuration management made their code testable. I failed to understand him but smiled and looked happy (it wasn’t a good moment for a discussion).

The answer M gave me was that it shouldn’t be a big deal. He then looked me in the eyes and added “And don’t let anyone tell you otherwise.”. It makes sense to me that if people make this huge deal about releasing code it turns into something scary and difficult. And there is a risk with that, it turns into something you would rather do as little as possible.

The conclusion, releasing code should be simple.

Another hint was a podcast from .NET Rocks that I listened to on my bike ride to Old Campus. The topic was James Kovacs on Convention over Configuration. The message was simple: by using conventions rather than configuration setting things up can be done in a much simpler manner. You don’t need to worry about the “plumbing” in the same way. Also it makes your systems easier to test since it is possible to test the convention and then be assured that it is working.

Here, implementing code should be simple.

As for me personally, I want to have the time for my 2 year old, roleplaying Star Wars, listening to podcasts, working out, sewing, etc, I don’t have the time or energy for complicated.


Howto: turn on logging in Project White

October 27, 2009

Note: After moving my code, this wasn’t enough anymore, I did some additional changes.

Of course I ran into an issue: on one MDI child window I couldn’t find any components but on another it worked fine. I gave myself the task to try the built in logging funtion.

This is how you set it up when you are running Visual Studios testrunner.

To begin with, find you’ll find the file log4net.config in the installation folder for White.

Copy it to the root folder of your test project (where all the code to your tests are).

In Visual Studio, select your project, right click and choose “Add”->”Existing Item”. Make sure “All files” is selected. Choose log4net.config from the list.

Now,  click on the file in Visual Studio and look at it’s properties.
You should set them so that it says “Build Action: content” and “Copy to output directory: copy always”.

After that, add window.LogStructure() in the test where you want to do the logging. Of course, replace “window” with the name of your window.

Build the project, run the test and a log file should have been created.


Testing a new system

October 16, 2009

This is a classic problem: coming in as a new tester on a system that you are unfamiliar with.
I enjoy it. Clicking around, exploring the features, trying to figure out how they are supposed to be used. Sometimes I’m amazed of how clever an implementation is and sometimes frighten by the poor usability.

But the hard part is not knowing which things are bugs and which are features. I’m constantely popping in in the developer room (why am I not seated with them?) asking “Hey, is this a bug or a feature?”. But my philosophy is that if I encounter something that might be a bit fishy, I better report it than let it be.

However, I’m concerned that reporting all of these things will make me seem annoying to the developers. Maybe they see me as complaining about their design and their work. I do my best to report possible bugs without putting any judgement in them. I hope that helps.


Compliment

October 9, 2009

Sometimes you receive a compliment that gives you a sense of satisfaction about what you have done. Sometimes you receive one that only makes you want more. I feel inspired. Thank you.