Howto: do basic things using ProjectWhite/White

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

Where does quality come from?

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.

Howto: turn on logging in Project White

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

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.