[TFUI] RE: [TDD] Re: A better way to test the GUI?

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.programming.test-first-user-interfaces,gmane.comp.programming.test-driven-development
Organization Poole Consulting
Message-ID <001701c507ef$9ca1e140$8119fea9@siena>
Hi Phlip,

> -----Original Message-----
> From: Phlip [mailto:[email protected]] 
> Sent: Monday, January 31, 2005 11:00 AM
> To: [email protected]; 
> [email protected]
> Subject: Re: [TDD] Re: A better way to test the GUI?
> 
> 
> 
> Charlie Poole wrote:
> 
> > Hi Phlip,
> > 
> > In theory, it's simple, but in practice?
> > 
> > I don't know about Java, but in .NET the Graphics class is sealed 
> > doesn't implement any interface but IDisposable. So it's 
> not easy to 
> > substitute a mock. However, the class is 
> MarshalByReference, so with 
> > some work, you should be able to spin up a proxy that would 
> convince 
> > Paint it was talking to a real System.Drawing.Graphics object.
> > 
> > The graphics object is passed to OnPaint as a member of a 
> > PaintEventArgs, which is trivial to construct. You would 
> just need the 
> > pseudo-Graphics object we just hypothesized and a bounding 
> rectangle.
> > 
> > Of course, OnPaint is called by the .NET framework, 
> whenever painting 
> > is needed. It's not likely that we can get .NET to use our 
> own mock in 
> > making this call, so we need to Mock .NET as well. :-;
> > 
> > For the simple cases, you could derive a class from your custom 
> > control, expose a public method that called OnPaint, and 
> pass in your 
> > own object. Alternatively, you could call it through 
> reflection. For 
> > the non-simple cases, well... it's not that "simple".
> > 
> > I'm not disagreeing with your principle, but I think you may have 
> > given the impression that it's _easy_ to plug in a mock graphics 
> > object, and it currently isn't. I'm doing a lot of work on 
> this and I 
> > might eventually have a framework that does this stuff. If 
> we can make 
> > it as easy as using a mock framework, then the
> > economic tradeoff changes. Right now, you have to be 
> willing to put in a
> > fair bit of effort, which makes the
> > approach viable only for projects that see a very strong 
> need for this
> > level of testing.
> 
> Is my estimate correct that there is no widespread, commonly 
> available canvas control available for the Java GUIs and C# GUIs?
>
> This is not rocket surgery. If you don't need super-advanced 
> real-time visualizations, then you don't need raw paint 
> commands. The effort to mock those commands exceeds the 
> effort to build a simple canvas control, like Tk Canvas.

I'm not entirely sure what you mean by a canvas control. I was
responding
to the notion that it's relatively simple to mock the Graphics object.
Maybe
that's not what you meant though...

Charlie

> 
> -- 
> Phlip
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 




To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
 
Yahoo! Groups Links

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

<*> To unsubscribe from this group, send an email to:
    TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.