maandag 14 maart 2011

WatiN has a new home

After some work in the last month, WatiN has a new home: http://watin.org/

Most of the layout has stayed the same but all the content on the pages have been updated to the recent state of affairs.

The website is now running on WordPress. This makes it much easier to update the site but also to give others rights to add/edit content on the site. If you find anything not working (links for instance) or are interested in helping out maintaining the site, let me know!

woensdag 16 februari 2011

Released WatiN 2.0 Final

Last week I have release WatiN 2.0 Final (2.0.50.1179). You can download the zip file from Sourceforge:

http://sourceforge.net/projects/watin/files/WatiN%202.x/2.0%20Final/WatiN-2.0.50.1179.zip/download

or install it using NuGet (need to have the Package Manager console for Visual Studio 2010 installed, get it at nuget.org). To add it to your project is as simple as:

PM> Install-Package WatiN

The release notes can be found on the new website http://watin.org (which is still in flux but getting there)

http://watin.org/documentation/release-2-0-50-11579/

Enjoy Testing with WatiN!

vrijdag 2 april 2010

jQTouch detail style

I’m working on a mobile application for the iPhone and I am using jQTouch to make the UI look like an iPhone app. jQTouch seriously helps you to quickly create a nice looking UI  but sometimes you need to write your own css to create the layout you want.

I needed a detail page with data shown like the contact details do on the iPhone. Since none of the jQTouch themes had some class that I could use, I sat down and finally came up with this little piece of css:

Now all you need to do is apply the detail class to your li element and place the name and the value inside two divs like so

And the result will look like

Technorati Tags:

maandag 29 maart 2010

TDD Workshop

#shamelessplug

Last month I gave a very successful TDD workshop. If you are interested in a TDD workshop, know about C# or Java and happen to be in the Netherlands, have a look at our schedule here (in Dutch) and read the blog about our workshop (also in Dutch).

I’m also in the process of creating a 2 day WatiN training. I’ll blog about this as soon as more info is available.

vrijdag 15 januari 2010

Browser.AttachTo<T> and IAttachTo

In WatiN RC1 the functionality to attach to a browser instance has had a complete redo. This had two reasons:

  1. Being able to attach to a browser in a browser agnostic way.
  2. Being able to return your custom browser type.

Download the example code here

From the old way to a browser agnostic way

If you don’t intend to run your tests with different browsers, you still need to make a small change in your code when upgrading to WatiN RC1.

image

needs to be changed into

image

which is the same as

image

and the same as

image

As you can see in the last example, you can pass in a type which should inherit WatiN.Core.Browser. The following example shows you how to utilize this method in situations where you get a browser instance injected into your test code. In the example the link that is clicked on will open up a new browser instance and we want to verify the text in this newly opened browser instance.

image

Thanks to this new AttachTo(type, findBy) method there is no knowledge at all of the used browser type inside my test code.

Returning a custom Browser type from AttachTo()

Many of us who use WatiN will probably use their own custom super duper version of WatiN.Core.IE. Providing new or different behavior then the default IE implementation does. See here for example  (and yes this part of the post was also a little bit sparked by their need to write their own AttachTo methods).

Here is my great MyIE class which overrides the ToString method and returns the Title and Url of the shown page (it’ll surf just as an example).

image

And now I want to be able write

image

When I run this piece of code, WatiN will throw this exception:

WatiN.Core.Exceptions.WatiNException: 
No AttachToHelper registered for type WatiN.Examples.Tests.MyIE.

That does sound like Ican register an AttachToHelper for a browser Type, doesn’t it. The Browser class provides a method RegisterAttachToHelper doing just that.

So we need to create our own AttachToMyIEHelper class. Since MyIE is inheriting IE, AttachToMyIEHelper will inherit AttachToIEHelper. And then it is just a matter of overriding the CreateBrowserInstance method, return a new instance of MyIE and we are done. Here is the implementation:

image

And this code shows you how to register the new AttachToMyIEHelper and use it in your tests.

image

Enjoy testing with WatiN.

Technorati Tags:

Combine WatiN and White to test Silverlight

Googling the web for stuff written about WatiN, I came across this very interesting article to combine forces between WatiN and White.

http://leobartnik.net/blog/2010/01/silverlight-uiautomation-testing-using.html

It also sparked this idea:

var  silverlightControl = browser.Control<SilverlightControl>(Find.ByFirst());

silverlightControl.Button(Find.ById(“someButton”)).Click;

Interesting.

Technorati Tags:

dinsdag 22 december 2009

Released WatiN 2.0 RC 1

A short shout out to announce the release of WatiN 2.0 Release Candidate 1.

Many fixes and new features since the last beta 1 release way back in March. I’m still compiling the list of changes so check back on this page later this week. But if you follow my blog you are well informed already. If you haven’t been using beta 1, start reading the release note of that release here.

And of course  you want to download the new release.

Enjoy testing with WatiN!

Technorati Tags: