SpecFlow and testing a Windows GUI

3,769 views
Skip to first unread message

Robert

unread,
Dec 16, 2011, 5:48:54 PM12/16/11
to spec...@googlegroups.com
I'm new to SpecFlow and relatively new to C#, but I'm not new to Cucumber and the Gherkin language used by both frameworks -- I've developed several projects using Cucumber and Java.  I'd like to test a Windows GUI application. Is that possible? Is it recommended? Are there C# libs that can test a Windows GUI?

satish venkatakrishnan

unread,
Dec 16, 2011, 5:57:43 PM12/16/11
to spec...@googlegroups.com
you can use  http://white.codeplex.com/   framework for testing Windows GUI

Robert

unread,
Dec 16, 2011, 6:09:26 PM12/16/11
to spec...@googlegroups.com
Hi Satish,

Thanks for the reply.  Have you had any success in using white with SpecFlow? That is to say, having SpecFlow drive the underlying automation using white?

Jon Archer

unread,
Dec 16, 2011, 6:21:28 PM12/16/11
to spec...@googlegroups.com
My team tried White for a bit. It's pretty good but we didn't totally
love it for our needs. We have a pretty funky app though that's all
about image processing. Perhaps a more form/dialog-oriented app would
be easier/more valuable. For us it was a fuss and the image
manipulation "under" the GUI was a more interesting target anyway.

We ultimately have chosen to cut out the GUI and test below. Our app
is using WPF for the GUI and we're following the MVVM pattern which
makes this relatively easy...just instantiate the ViewModel under the
main window et voila. All that said, we've only been at it a couple
iterations so only a handful of features tackled this way.

Hope that helps. My advice would be to just try White and see how you find it.

Cheers,
Jon

Sent from my iPhone

Ben

unread,
Dec 19, 2011, 5:47:05 AM12/19/11
to SpecFlow
Yes - we got SpecFlow to drive automated tests for our WinForms app. I
think we
did look at White, but ended up going with the MS Coded UI Framework
(part of VS 2010).
At the end of the day, both frameworks are built on top of the
UIAutomation layer, and so work
in the same kind of way.

The main difference between the two (at least from my limited
investigation of White at the time) is the
framework's API. But going back and looking at White just now (to
refresh my memory),
the API in White is more suited to use by developer's manually writing
code, where as the API in the Coded UI
Framework is optimized towards code generation (and indeed that's what
most of the documentation
you'll find is about - Coded UI Tests in Visual Studio are geared
towards "record and replay")

Robert

unread,
Dec 19, 2011, 5:43:58 PM12/19/11
to spec...@googlegroups.com
Some great feedback from all participants. Thanks very much

satish venkatakrishnan

unread,
Dec 19, 2011, 6:14:11 PM12/19/11
to spec...@googlegroups.com
Sorry, was late to the show,..,. ya i have written code for the UI testing.. we dont do record replay because its breaks often annoyingly, which is one thing which we want to avoid through doing a page pattern.. Look at watin.org for more explaination on the pattern and specflow embraces it very well 

Ivan Pavlović

unread,
Dec 20, 2011, 5:29:47 AM12/20/11
to SpecFlow
White is great! I'm sending you example (in the separate email) I'm
using to show possibilities of UI testing with white+specflow

Ivan Pavlović

unread,
Dec 20, 2011, 5:31:56 AM12/20/11
to SpecFlow
Here is the link with example http://hive-studios.com/blog/hive-studios-on-devreach-and-sinergija

Cheers
Ivan

On Dec 19, 11:43 pm, Robert <restag...@gmail.com> wrote:

Robert

unread,
Dec 20, 2011, 6:32:00 PM12/20/11
to spec...@googlegroups.com
This is great stuff!!! Thanks for sharing

Steve Wilkinson

unread,
Jan 18, 2012, 4:41:20 AM1/18/12
to spec...@googlegroups.com
Appreciate this is a slightly old post but wanted to add some caveats for those thinking of using White.  I have had a number of problems with testing a WPF app using SpecFlow and White - it seems that White isn't that robust in a few areas when it comes to WPF.  One area I had trouble with was WPF comboboxes - I posted a work-around on StackOverflow here: http://stackoverflow.com/questions/5814779/selecting-combobox-item-using-ui-automation.  You need to know how to get to the AutomationElement from a UIItem - simply cast to IUIItem and reference the AutomationElement property.  I had to do a similar amount of hacking to get WPF checkboxes to work reliably - the out-of-the-box White support worked okay on my laptop but wouldn't work on my (faster) desktop.  Given more time, I would dump White and go direct to the Microsoft UI Automation libraries, but White seems like a good way to get started on all this.

Robert

unread,
Jan 18, 2012, 5:46:59 PM1/18/12
to spec...@googlegroups.com
As it turns out, White did not meet our needs.  One of our developers had a look at White and attempted to work with it using one of our more complicated Windows applications.  For the most part, White performed well.  However, when it came to 3rd party apps, it did not do very well.  So, we are looking for alternatives.

nitro52

unread,
Jan 18, 2012, 9:46:24 PM1/18/12
to SpecFlow
Another option could be Coded UI Tests, This is the GUI Functional
test from Microsoft. Its first gen so their are some areas you need to
be aware of but it is also quite extensible. What platform is the app?
is it Win32 or .net WinForms? Coded UI Tests use 2 different methods
to detect the control properties. With Win32 and WinForms apps it uses
MSAA (Microsoft Active Acessability). This basically requires the
control to expose its properties via the IAccessable interface. We
have an only legacy VB6 app we were looking at using it for.
Unfortunately VB6 isn't very Accessible and often controls get mixed
up. The fix would for the control to implement the IAccessable
Interface but you can't do this in VB6. I was looking at writing a UI
Test Extension for Coded UI Tests which basically opened a channel
between VB6 and the Coded UI Test via WCF and COM but this basically
meant writing the code to handle each control type and property you
need but would give you greatly better support. We cancelled this idea
after realising the time we would invest into the project probably
wouldn't be worth it when the lifespan of the app was coming to an
end.

In saying that extending coded ui tests for newer technologies should
be a lot easier. I wrote a blog series on getting Coded UI Tests to
work with Specflow which you can find here
http://rburnham.wordpress.com/2011/03/15/bdd-ui-automation-with-specflow-and-coded-ui-tests/

If you need any more info let me know the platform the app is written
in an i should be able to give you some advice.

Steve Wilkinson

unread,
Jan 19, 2012, 4:28:34 AM1/19/12
to spec...@googlegroups.com
Robert - if you are willing to consider commercial alternatives for testing your third-party apps, I have heard good things about SmartBear's TestComplete.

Robert

unread,
Jan 20, 2012, 1:39:29 AM1/20/12
to spec...@googlegroups.com
Steve - Thanks for the suggestion.  We are currently looking into the possibility of using either TestComplete or Ranorex

bis

unread,
Jan 20, 2012, 10:59:07 AM1/20/12
to spec...@googlegroups.com
I have used white on a few projects it did not work bad at all and have also use the MS Automation stuff white was better than that.

Jaya

unread,
Dec 9, 2013, 9:41:06 AM12/9/13
to spec...@googlegroups.com
Hi Satish,

I am very new to specflow and never used any automation before. However, I'll be using specflow for my project going forward. Watched videos but cannot get head around it. Can you walk me through few test cases or can send links to videos which guide from the scratch.
I need to test the GUI. And also is it possible to give me contact details. 
Many Thanks in advance,

Umair Chagani

unread,
Dec 10, 2013, 7:05:22 AM12/10/13
to spec...@googlegroups.com

Please see the example here: https://github.com/uchagani/ShoeStore

It uses SpecFlow and WebDriver in a PageObject pattern.

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

rsou...@gmail.com

unread,
Dec 12, 2013, 3:54:04 PM12/12/13
to spec...@googlegroups.com, umair....@gmail.com
Hi Satish,

Thanks for providing such simple readable example.I am following your example, URL:http://manheim-shoe-store-uchagani.herokuapp.com in the example is not working. Please provide the updated url.

Thanks in Advance.
Reply all
Reply to author
Forward
0 new messages