Roman Gavrilov | 1 Dec 2004 18:16

Testing ToString()


I have a simple class that represents X-Y point, that implements
ToString() that yields string-representation of the object.

How do I test the ToString() method?

Here are options I've considered:
1. Hardcode expected result as in "X=1.0 Y=2.0" - does not address issue
of localization.
2. Create expected result using API tools - this adds some complexity to
the test case.
3. Verify that assumed locale is set and then run the testcase or yield
warning and skip the test if different local selected.

Any ideas?

Roman V. Gavrilov

******************* IMPORTANT MESSAGE *******************************
Internet communications are not secure and therefore, Fischer Imaging does not accept legal
responsibility for the contents of this message including any material attached to it. Any views or
opinions presented are solely those of the author and do not necessarily represent those of Fischer
Imaging, unless otherwise specifically stated. This email is confidential and may be legally
privileged. 

The copying, broadcasting, publishing or dissemination electronically or by any other means of the
contents of this email or its attachments is prohibited, unless expressly authorized by the sender. It is
the responsibility of the recipient to ensure that they have virus protection and no responsibility is
accepted by Fischer Imaging for any loss or damage arising in any way from receipt or use thereof of this
email or its attachments.
(Continue reading)

jetpoet | 1 Dec 2004 11:57
Picon
Favicon

TDD and webdevelopment


Hi all,

I am new to the list! After having put off getting
into TDD, I have finally installed NUnit and ordered
the book "Test Driven Development in .NET", by J.
Newkirk.

But since I primarily develop database driven
websites, I was wondering if there were any good
articles out there on how to go about doing that in a
TDD environment. I haven't been able to find any.

Just to give you an idea of the scenario I usually
develop in, so you can suggest good articles and books
here is what I usually work with. I develop in C# and
use SQL Server for backend purposes. I have developed
a dataaccess layer that retrieves all data using SQL
XML. I develop websites that require user login for
access to tools and services. I also develop backend
services for data exchange. These are web service when
I can get away with doing it that way.

Thanks in advance!

JP

------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/NhFolB/TM
(Continue reading)

George Dinwiddie | 1 Dec 2004 19:22

Re: Testing ToString()


On Wed, Dec 01, 2004 at 10:16:39AM -0700, Roman Gavrilov wrote:
> 
> 
> I have a simple class that represents X-Y point, that implements
> ToString() that yields string-representation of the object.
>  
> How do I test the ToString() method?
>  
> Here are options I've considered:
> 1. Hardcode expected result as in "X=1.0 Y=2.0" - does not address issue
> of localization.
> 2. Create expected result using API tools - this adds some complexity to
> the test case.
> 3. Verify that assumed locale is set and then run the testcase or yield
> warning and skip the test if different local selected.

Test the behavior you want to see.
 1. Set up instances of the class and assert the expected toString()
results.
 2. If the results should vary based on some external conditions, such
as locale, set up instances of the class under those conditions and
assert the toString() results.

I'm not sure what you mean by your second option.

 - George

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
(Continue reading)

Keith Nicholas | 1 Dec 2004 21:45

RE: Testing ToString()


Its not quite the problem as far as I can tell and have had experienced.

Its not that you have to localize the actual object, the problem is that if
you change the locale and run all your tests you get different results.
The idea being you want to see if things still pass if you change locale.

Option 2 is probably your best bet.Try and make your tests locale tolerant.

Regards,

Keith

  _____  

From: George Dinwiddie [mailto:programminglists <at> alberg30.org] 
Sent: Thursday, 2 December 2004 7:23 a.m.
To: testdrivendevelopment <at> yahoogroups.com
Subject: Re: [TDD] Testing ToString()

On Wed, Dec 01, 2004 at 10:16:39AM -0700, Roman Gavrilov wrote:
> 
> 
> I have a simple class that represents X-Y point, that implements
> ToString() that yields string-representation of the object.
>  
> How do I test the ToString() method?
>  
> Here are options I've considered:
> 1. Hardcode expected result as in "X=1.0 Y=2.0" - does not address issue
(Continue reading)

Mikhail Shnayderman | 1 Dec 2004 23:21
Picon
Favicon

RE: Testing ToString()


To me Option 2 seems also the most reasonable.

I would also try to make a point that if it is
possible
to change the X-T point class, so that Locale
information is not used as a system-wide (global)
value, but is rather passed to the X-Y point; you may
have an easier time in testing.

I do see that this maybe a design smell, and you may
not want your X-Y point (possibly a domain concept) to
depend explicitly in its X-Y point interface on
Locale.

In case if you want to have X-Y point clear of locale
related details you may want to use "Decorator"
LocalizedXYPoint or an idiom similar to the one used
in JDK - NumberFormatter, DateFormatter, or in your
case possibly XYPointFormatter. 

Notice, in all the solutions I identified, you are
making it explicit to the clients of either
LocalizedXYPoint or XYPointFormatter or XYPoint that
there is dependency on Locale.

As far as testing, consider creating with given to you
API tools a computed set of XYPoint ToString
representation.  You may event want to tabularize the
results and have a table linking one of supported by
(Continue reading)

Keith Nicholas | 1 Dec 2004 23:28

RE: Testing ToString()


I would tend away from letting the point class know about a locale, it
doesn't really care.

The only thing that cares is the string creation and in C# if you build your
string from ToStrings then you never have to know about your locale, which
is nice, except in this very case that you change it and your tests break
:-)

 
  _____  

From: Mikhail Shnayderman [mailto:mschnayd <at> yahoo.com] 
Sent: Thursday, 2 December 2004 11:22 a.m.
To: testdrivendevelopment <at> yahoogroups.com
Subject: RE: [TDD] Testing ToString()

To me Option 2 seems also the most reasonable.

I would also try to make a point that if it is
possible
to change the X-T point class, so that Locale
information is not used as a system-wide (global)
value, but is rather passed to the X-Y point; you may
have an easier time in testing.

I do see that this maybe a design smell, and you may
not want your X-Y point (possibly a domain concept) to
depend explicitly in its X-Y point interface on
Locale.
(Continue reading)

Mikhail Shnayderman | 1 Dec 2004 23:42
Picon
Favicon

RE: Testing ToString()


Sorry,

I have been too long in Java world and forgot about
the fact that we maybe talking about a completely
different Language.

In either case, I am sure you should be able to make
changes I outlined (make Locale not part of X-Y point,
but rather something that wraps or uses X-Y point),
you can use "Decorator" if you want to preserve
ToString based localization, or if you do not care and

are willing to part with ToString (which I understand
could be hard :), have a separate "formatter".

There are definite advantages and disadvantages to 
both approaches (Decorators are memory-intensive (more
objects), Formatters are external to the class and 
make interfaces more complicated to the clients), but
pick one and use it.

Also, I don't know C# that well, but you may enable to
specify Locale on XYPoint in a somewhat innocent way
by using "internal" access modifier on "locale"
property.  My C# is pretty bad, so I can't say if you
possibly have something like a friend assemblies or
classes.  

Anyway, just giving you a few things to think about.
(Continue reading)

Jill Coleman | 1 Dec 2004 20:10
Picon
Favicon

What does it take to be an application architect?


Hi everyone,
I was curious to know about what it would take to be an application 
architect. I am currently a VB/ASP/SQL developer, and am looking to 
move up on the ladder.
Any ideas, feedback that anyone here could provide would be greatly 
appreciated.

Thanks

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/NhFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> To unsubscribe from this group, send an email to:
    testdrivendevelopment-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

nbsmxs | 1 Dec 2004 18:58
Picon
Favicon

Testing menu functionality


I thought I was doing good writing tests and then I hit a roadblock.  
I'm hoping someone can help me here:

I'm creating an application that allows the user to enter text.  If 
they then hit the File|New menu item, I want to verify that a message 
box is displayed asking if they want to save their changes, with 
Yes/No/Cancel buttons.  (Similar to any editor you've ever used).  I 
then want to verify the application responds properly to each of the 
three options.

What I'm stumped on is how to verify that the messagebox is being 
displayed with the correct buttons?  And do I really want to be 
popping up this dialog during testing (even though the tests will 
close it)?  It just smells bad to me.  Any suggestions on how else I 
can test this functionality?

Thanks,
   Mike

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/NhFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
(Continue reading)

Russell Gold | 2 Dec 2004 12:15
Picon

Re: What does it take to be an application architect?


On Wed, 01 Dec 2004 19:10:15 -0000, Jill Coleman
<jill_coleman30076 <at> yahoo.com> wrote:
> 
> 
> Hi everyone,
> I was curious to know about what it would take to be an application
> architect. I am currently a VB/ASP/SQL developer, and am looking to
> move up on the ladder.

The industry has no standard for titles. An "application architect"
might be anything from a "senior" developer to somebody who does no
coding at all. Check with your employer to see what they think the
title means and what you have to do to get it.

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/NhFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> To unsubscribe from this group, send an email to:
    testdrivendevelopment-unsubscribe <at> yahoogroups.com

(Continue reading)


Gmane