Alan Baljeu | 9 Nov 2011 15:12
Picon
Favicon

VC 2008 dynamic dialogs

I'm looking for hints on development in C++/CLI and/or C# with VS2008, following a test-driven
approach.  

Windows-based application.

Modeless dialog.

Data entry immediately invokes handlers.
Data-binding is a possible approach.
May migrate to VS2010 midproject.

I'm familiar with WinForms in VS2003, but I understand things are radically better now.  So I'm looking
for a clue on technology, and instruction on developing this stuff through TDD.
 
Alan Baljeu

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/testdrivendevelopment/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/testdrivendevelopment/join
(Continue reading)

Amir Kolsky | 9 Nov 2011 17:07
Picon
Favicon

RE: VC 2008 dynamic dialogs

One thing to keep in mind is that the tests that you will write will not
depend on the platform that you're using; 2003, 8, or 10. Your tests will
capture the behavior of your dialogs, not their implementation. This will
also allow you to reuse your tests as you move from 2003 to (say) 2010.

The other thing to pay close attention to is to deploy and MVC like model,
have your UI be a simple adapter delegating all the UI work to an
application object(s) in the background. You will translate all user input
to logical operations. Then you can TD the D of that application object.
This removes a lot of the ugliness of test driving user interfaces as you
don't have to deal with the actual UI implementation.

Based on how much effort you want to put into it, you can, also test drive
the user interface, although for the most part it is but an adapter with NO
logic in it. Notice that what you test is not the user interactions, like
what happens if the user hits an 'X' into the FooBar field which currently
contains 'YYY'. This you do in the logical object. What you test is that in
the aforementioned case is that the UI generates an AttemptToChangeFoobar
event with the appropriate parameter (("YYXY") or (INSERT, 'X', 3), or
whatever makes sense for you).

From: testdrivendevelopment <at> yahoogroups.com
[mailto:testdrivendevelopment <at> yahoogroups.com] On Behalf Of Alan Baljeu
Sent: Wednesday, November 09, 2011 6:13 AM
To: testdrivendevelopment <at> yahoogroups.com
Subject: [TDD] VC 2008 dynamic dialogs

I'm looking for hints on development in C++/CLI and/or C# with VS2008,
following a test-driven approach.  

(Continue reading)

Alan Baljeu | 9 Nov 2011 17:33
Picon
Favicon

Re: VC 2008 dynamic dialogs

Thank you.  That's a start.

I won't be migrating from 2003, I'm creating new stuff, learning new technology.
I also follow an MVP pattern typically.  I wonder if it's best to build the dialog using the GUI editor, or
manually, and if there is a choice of technologies to use, and if one approach works better for TDD.

 
Alan Baljeu

________________________________
From: Amir Kolsky <kolsky <at> actcom.net.il>

  
One thing to keep in mind is that the tests that you will write will not
depend on the platform that you're using; 2003, 8, or 10. Your tests will
capture the behavior of your dialogs, not their implementation. This will
also allow you to reuse your tests as you move from 2003 to (say) 2010.

The other thing to pay close attention to is to deploy and MVC like model,
have your UI be a simple adapter delegating all the UI work to an
application object(s) in the background. You will translate all user input
to logical operations. Then you can TD the D of that application object.
This removes a lot of the ugliness of test driving user interfaces as you
don't have to deal with the actual UI implementation.

Based on how much effort you want to put into it, you can, also test drive
the user interface, although for the most part it is but an adapter with NO
logic in it. Notice that what you test is not the user interactions, like
what happens if the user hits an 'X' into the FooBar field which currently
contains 'YYY'. This you do in the logical object. What you test is that in
(Continue reading)

Lior Friedman | 9 Nov 2011 17:40
Picon

Re: VC 2008 dynamic dialogs

if you are going for new staff you might want to reconsider using WPF.
I understood its much easier than winforms.

regarding tests, following MVP is the first step.
you might wish to grab a good isolation tool to help with the nasty GUI
staff.
that should allow you to develop TDD style.

You can also check windows GUI automation tools such as:
MS Coded UI Tests (i think its available at 2008 but I'm not sure, it is
present in 2010)
Project White
Something like this will let you automate E2E testing.o
ad maybe help to test the presentation layer

Regards
Lior Friedman
blog - http://imistaken.blogspot.com

On Wed, Nov 9, 2011 at 6:33 PM, Alan Baljeu <alanbaljeu <at> yahoo.com> wrote:

> **
>
>
> Thank you.  That's a start.
>
> I won't be migrating from 2003, I'm creating new stuff, learning new
> technology.
> I also follow an MVP pattern typically.  I wonder if it's best to build
> the dialog using the GUI editor, or manually, and if there is a choice of
(Continue reading)

Donaldson, John (GEO | 10 Nov 2011 12:15
Picon
Favicon

RE: VC 2008 dynamic dialogs

Alan,

I have developed using WPF and with WinForms.
I got used to having a "Humble Dialog", but included some tests which involved getting controls and
actioning them - for example "press the button". These can be simple wiring tests, or acceptance tests.
This is easy and obvious with WinForms. But for me it was less obvious when first using WPF.

I found it quite difficult to get hold of a specific control - say a button - in WPF.
And eventually, to keep things simple, I decorate the visual element I am testing with a method such as
GetControl("nameofcontrol"). That gets the button or whatever. Then it's not so easy to "press" it.
There is not method "Press". You have to send the control an event. It's ok when you've done it once - but when
moving from WinForms to WPF I was stumped for a while.

You absolutely should WPF (you can still use WinForms) - it's far richer and more consistent. 
The downside is it's more complex, and a radically different architecture.

John D.

-----Original Message-----
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Alan Baljeu
Sent: 09 November 2011 15:13
To: testdrivendevelopment <at> yahoogroups.com
Subject: [TDD] VC 2008 dynamic dialogs

I'm looking for hints on development in C++/CLI and/or C# with VS2008, following a test-driven
approach.  

Windows-based application.

(Continue reading)

Alan Baljeu | 10 Nov 2011 13:38
Picon
Favicon

Re: VC 2008 dynamic dialogs

This is indeed a challenge. It's a shame CLR designers never thought about programatic driving of an interface.
Now what about dynamic Ui?  If the set of controls changes at runtime depending on which model object is being
presented (but the window is the same), and users will be able to design their own objects with different
properties -— does XAML suit this purpose?  Does WPF?  Is TDD of the dialog-builder viable, given how hard
you say it is to access the control objects?

Alan Baljeu

On 2011-11-10, at 6:15 AM, "Donaldson, John (GEO)" <john.m.donaldson <at> hp.com> wrote:

> Alan,
> 
> I have developed using WPF and with WinForms.
> I got used to having a "Humble Dialog", but included some tests which involved getting controls and
actioning them - for example "press the button". These can be simple wiring tests, or acceptance tests.
This is easy and obvious with WinForms. But for me it was less obvious when first using WPF.
> 
> I found it quite difficult to get hold of a specific control - say a button - in WPF.
> And eventually, to keep things simple, I decorate the visual element I am testing with a method such as
GetControl("nameofcontrol"). That gets the button or whatever. Then it's not so easy to "press" it.
There is not method "Press". You have to send the control an event. It's ok when you've done it once - but when
moving from WinForms to WPF I was stumped for a while.
> 
> You absolutely should WPF (you can still use WinForms) - it's far richer and more consistent. 
> The downside is it's more complex, and a radically different architecture.
> 
> John D.
> 
> -----Original Message-----
> From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com]
(Continue reading)

Donaldson, John (GEO | 10 Nov 2011 13:59
Picon
Favicon

RE: VC 2008 dynamic dialogs

Alan,

I didn't want to give the impression that it's really difficult. Just that it has changed quite a bit, and
that it's a bit harder. But for a TDD jockey like you - it should not be a problem. :-)

WPF is much improved over WinForms. So, IMHO you should definitely go that way.

The whole XAML story is very interesting and useful. And I guess you might actually TDD the creation of XAML
which would then run in the test. Interesting idea - but I didn't work like that. I used the visual editor to
get a rough draft of the screen I wanted, then subsequent mods by modifying the XAML. But I did not test drive
the visual surface - the TDD started with a button press, or the selection of a list item etc.

By the way adding a method to get a control works easily - just inherit the "testing" interface which
includes GetControl.

TDDing a dynamic UI? Hmm! What would the story be? Something like:
   - a user can select a control from a list and add it to the current surface. ?

I wonder if you could just inspect the resulting XAML? Perhaps it would be enough. Especially if one of your
controls has a button and you manage to press it? Then have some kind of event wiring?

Sounds interesting.

John D.

-----Original Message-----
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Alan Baljeu
Sent: 10 November 2011 13:38
To: testdrivendevelopment <at> yahoogroups.com
(Continue reading)

Alan Baljeu | 10 Nov 2011 15:13
Picon
Favicon

Re: VC 2008 dynamic dialogs

>TDDing a dynamic UI? Hmm! What would the story be? Something like: 
>- a user can select a control from a list and add it to the current surface. ? 

Users don't think about controls; they think about properties.  So "add a text property named 'creator'
to selected object", "add a linear dimension named 'length'", "reorder properties".  

In fact this won't be the average user, but a system admin or a director of technology implementation doing
this kind of thing.  For the average user, the use case would be "display properties of selected object,
and edit them".

-----Original Message----- 
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Alan Baljeu 
Sent: 10 November 2011 13:38 
To: testdrivendevelopment <at> yahoogroups.com 
Cc: testdrivendevelopment <at> yahoogroups.com 
Subject: Re: [TDD] VC 2008 dynamic dialogs 

This is indeed a challenge. It's a shame CLR designers never thought about programatic driving of an
interface. 
Now what about dynamic Ui?  If the set of controls changes at runtime depending on which model object is
being presented (but the window is the same), and users will be able to design their own objects with
different properties -— does XAML suit this purpose?  Does WPF?  Is TDD of the dialog-builder
viable, given how hard you say it is to access the control objects? 

Alan Baljeu 

On 2011-11-10, at 6:15 AM, "Donaldson, John (GEO)" <john.m.donaldson <at> hp.com> wrote: 

> Alan, 
(Continue reading)

Paul Mackintosh | 10 Nov 2011 16:53
Gravatar

RE: VC 2008 dynamic dialogs

Much of WPF is dynamic by design, things like DataTemplate, ControlTemplate and Style can all declare
dynamic behaviour (to change the appearance and/or content of the UI) in XAML using Triggers and can be
added by a ‘designer’ in the Expression Blend tool.

With the MVVM pattern you have a ViewModel object per DataTemplate or UserControl and can test logic there
which keeps it out of the way of designers who can then use a dummy viewmodel that provides design time
data., MVVM is basically WPF flavoured MVP with an emphasis on using the WPF Binding system and DataTemplates.

These might be useful links for you:

http://www.codeproject.com/Articles/141853/Automate-your-UI-using-Microsoft-automation-framew

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Alan Baljeu
Sent: 10 November 2011 14:13
To: testdrivendevelopment <at> yahoogroups.com
Subject: Re: [TDD] VC 2008 dynamic dialogs

>TDDing a dynamic UI? Hmm! What would the story be? Something like: 
>- a user can select a control from a list and add it to the current surface. ? 

Users don't think about controls; they think about properties.  So "add a text property named 'creator' to
selected object", "add a linear dimension named 'length'", "reorder properties".  

In fact this won't be the average user, but a system admin or a director of technology implementation doing
this kind of thing.  For the average user, the use case would be "display properties of selected object, and
edit them".

(Continue reading)

Donaldson, John (GEO | 11 Nov 2011 11:50
Picon
Favicon

RE: VC 2008 dynamic dialogs

By the way, instead of adding a method to get hold of specific controls you can of course reflect on the
structure. 
But it's a very rich, complex and recursive structure with plenty of abstraction to handle.

TDDing things like adding text attributes might be quite easy to do at the XAML level. The test would just be
asserting that adding a textbox (or whatever) makes one appear in the XAML. Use Linq to XML and it's easy to manipulate.

John D.

-----Original Message-----
From: testdrivendevelopment <at> yahoogroups.com [mailto:testdrivendevelopment <at> yahoogroups.com] On
Behalf Of Alan Baljeu
Sent: 10 November 2011 15:13
To: testdrivendevelopment <at> yahoogroups.com
Subject: Re: [TDD] VC 2008 dynamic dialogs

>TDDing a dynamic UI? Hmm! What would the story be? Something like: 
>- a user can select a control from a list and add it to the current surface. ? 


Users don't think about controls; they think about properties.  So "add a text property named 'creator'
to selected object", "add a linear dimension named 'length'", "reorder properties".  


In fact this won't be the average user, but a system admin or a director of technology implementation doing
this kind of thing.  For the average user, the use case would be "display properties of selected object,
and edit them".



(Continue reading)


Gmane