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

Howto: Display code in wordpress

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;

}

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.