Unit tests are generally used for testing exposed and isolated pieces of
functionality in a repeatable fashion - with that in mind if your unit tests
are well written any adverse changes to private functions will have
repercussions for the exposed public methods, which you'll pick up the next
time the test suite is executed.

What your looking for isn't provided by NUnit and in fact seems of very
limited use in general, ie. Your testing system will need to find the class,
create an instance of it with a constructor the user would choose (or always
using the default constructor if available) and then select the function,
enter parameters and execute... I already see a problem arising that a lot
of classes people write don't live inside plastic bubbles... they require
multiple method calls to put an object in a fit state for use... and often
this requires other objects and so on... it's just not going to work very
well for anything but the most basic of situations...

Another option for this private functionality is to make it "protected"
instead of private - then inherit from the class ie.

class a
{
        protected bool methoda(int param1)
        {
        }
}

class testwrapper_a : a
{
        public bool TestMethoda(int param1)
        {
                return methoda(param1);
        }
}

However when would you ever have private methods in a class that never get
called by any properties / public methods... and if so what are they there
for?

- Alex Henderson
- .Net Developer
- Real Developments, New Zealand
- [EMAIL PROTECTED]

-----Original Message-----
From: Dean Cleaver [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 5:04 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] .NET testing tools

Can I ask how you use this to test "private" functions?

Like if I have a function to validate passwords, and that function is
private to the User class, then I guess the only way to use Nunit on it
is to make it public for the testing phase??? Can't say I like that idea
very much...

Dino

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Ethan Smith
Sent: Wednesday, 17 April 2002 04:12
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] .NET testing tools


http://nunit.sourceforge.net

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Stefan Finch
Sent: Tuesday, April 16, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] .NET testing tools

Does anyone know of any .NET testing tools.

Ideally, the user should be able to browse to some assemblies, choose a
method, enter its parameters and view the response.

Sounds like a good use of reflection, but before I build one, is there
anything out there that does this.

Best wishes

S





Stefan Finch. < CD9.com <http://www.cd9.com/>  >
Park House, 116 Park St, Mayfair,  <http://www.cd9.com/map> London, W1K
6NR | 020 7659 3912 | [EMAIL PROTECTED]

  _____

<Internet Email Confidentiality Footer>
This e-mail may be confidential and does not necessarily represent the
views of CD9Group. If you are not the intended recipient of this e-mail
or any parts of it then please immediately delete it from your system
and contact CD9Group on +44 20 7659 3900. You should not disclose the
contents to any other person, nor take copies.



You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.346 / Virus Database: 194 - Release Date: 10/04/2002


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.349 / Virus Database: 195 - Release Date: 15/04/2002

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to