473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

NUnit is worth to use ??

Hi, all.
I've know NUnit for a while, now I try to use it.
Most of application I develope is data base driven.
I want to test data layer most with may input and checking the result, then
compare with database if it returns right value or not.

To do so, I need to save all inputs and results as development, debugging
goes on..

But, NUnit doesn't seem to support it. and It require wrong Test coding.
I dont' feel still confident that it's worth to use it. Since It takes time
to write test code. I hope they provide auto test code generation reading
dll and generate test code for NUnit, So, I just type only input param. This
is what I desire.. One more thing, there is functionality to save all my
inputs so I can reuse the input after debugging to make sure all code still
work correctly.
If I can't do this with tool what the tool is for?

How do you guys use the tool in real world?
and What is best way to use it in my case?
Is there any other tools I can work with as well as NUnit??

Any comment will help!!
Thank you..
Jul 21 '05 #1
2 1747
Sky Kim wrote:
Hi, all.
Hi there, controversial topic you've chosen, I'm expecting a lot of
traffic in this thread... possibly something like "you need to use
state-pattern, and store it as a member in the test-class" :)
I've know NUnit for a while, now I try to use it.
I''ve used a few unit-test frameworks and have formed an opinion by now:
Unit-test frameworks are:

- applicable only for unit tests
- basically give you a success and failure-count

Integration tests are very hard to express in Unit-test terms, since
unit-tests usually are assumed to be unparametrised.

As you see, I'm not so fond of unit-test frameworks. Usually you end up
using some "configuration-language", which is not as powerfull as the
source-language and really dominates the way you code.

My current approach to testing is:

- Write tests, if a test is hard to write it will also be hard to
write the code that actually uses your library/class/... and something
may be wrong with the design (GUI tests are different)

- Code tests just like any other code, don't sacrifice simplicity to
fit into frameworks

- throw exceptions to indicate test-failure, be as specific as you
think is valuable, start with new Exception("reason"). Then refine that
to an exception with more information if an error is actually caught there

- dont use Assert(bool-expression), it removes meaning, define
functions like AssertEqual(object o1, object o2), that can throw
informational exceptions like "should be equal: {0}, {1}".

- compose sequentially dependent tests using language-sequencing:
void testFoo(DB db) { testBar(db); testBaz(db); }

- compose independent tests in adhoc-ways, whatever fits:

try {
testFoo(DB db);
} catch ( Exception e ) {
fail("testFoo", e, db);
}
try {
testBar(DB db);
} catch ( Exception e ) {
fail("testBar", e, db);
}

// or even (for the adventurous)
delegate void DBTest(DB db);
DBTest[] tests = { new DBTest(testFoo), new DBTest(testBar); }
foreach ( test in tests ) {
try {
test(db);
} catch ( Exception e ) {
// delegate wraps execptions
fail(test.Method.Name, e.Inner, db);
}
}

This approach makes for simple, easily readable, flexible tests, on the
downside, you have to count the successfull tests explicitly, if you
even care about how many there are.

Remember, tests are just programmes, and you should not write them any
differently than you would an actual program.
Most of application I develope is data base driven.
I want to test data layer most with may input and checking the result, then
compare with database if it returns right value or not.
Sounds like integration tests.
But, NUnit doesn't seem to support it. and It require wrong Test coding.
I dont' feel still confident that it's worth to use it. Since It takes time
Sounds reasonable, if the framework makes testing hard, it probably
isn't applicable :)
to write test code. I hope they provide auto test code generation reading
dll and generate test code for NUnit, So, I just type only input param. This
is what I desire.. One more thing, there is functionality to save all my
inputs so I can reuse the input after debugging to make sure all code still
work correctly.
Are you suggesting to "capture" the input and output during debugging?
and then automatically replay the interaction later?

Try doing this manually a few times before going "auto", if you havent
already done so. Perhaps you would rather just save verified "positives"
of input and output -- atleast for a start.

Is there something wrong with just serializing the inputs and verified
output, then for testing: deserialize input, send, deserialize
expected-output, compare with actual output?
How do you guys use the tool in real world?
NUNit, not anymore.
and What is best way to use it in my case?


To do what fits your situation... (obvious, but sadly much ignored :)

--
Helge
Jul 21 '05 #2
Check out NMock. It generates much of the mock object framework that is
needed to test a class seperately from the classes that it depends upon.

Not perfect, but pretty good.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Sky Kim" <sk*@datalinkage.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi, all.
I've know NUnit for a while, now I try to use it.
Most of application I develope is data base driven.
I want to test data layer most with may input and checking the result,
then
compare with database if it returns right value or not.

To do so, I need to save all inputs and results as development, debugging
goes on..

But, NUnit doesn't seem to support it. and It require wrong Test coding.
I dont' feel still confident that it's worth to use it. Since It takes
time
to write test code. I hope they provide auto test code generation reading
dll and generate test code for NUnit, So, I just type only input param.
This
is what I desire.. One more thing, there is functionality to save all my
inputs so I can reuse the input after debugging to make sure all code
still
work correctly.
If I can't do this with tool what the tool is for?

How do you guys use the tool in real world?
and What is best way to use it in my case?
Is there any other tools I can work with as well as NUnit??

Any comment will help!!
Thank you..

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Klas Mellbourn | last post by:
I have several assemblies, in separate dll:s, each with nunit tests embedded. Every assembly requires its own config file. I would like to run all nunit tests on the same command line. Like this: ...
2
by: d2d | last post by:
How are you doing there folks? I just have this newbie question about how to compile an NUnit test file from command line using "csc.exe" I installed NUnit 2.1 using *.msi file. I was...
4
by: julien | last post by:
Hello, I wonder how people test private methods with NUnit: is it a good idea to have a special build with all methods made public? Is there a better way? I you make a special build for NUnit,...
2
by: Sky Kim | last post by:
Hi, all. I've know NUnit for a while, now I try to use it. Most of application I develope is data base driven. I want to test data layer most with may input and checking the result, then compare...
0
by: Ray Tayek | last post by:
hi, getting a: .\Stdafx.cpp : fatal error C1192: #using failed on 'i: nunit\samples\cpp-sample"' 'The filename, directory name, or volume label syntax is incorrect.' nunit is installed in...
6
by: Ray Tayek | last post by:
hi, i am preparing to teach a class in c++ and would like to intoduce some unit testing. i can make unit tests in c# using this dll and nant from the command line. i am using visual c++ 2005...
20
by: Parag | last post by:
Hi, I am trying to figure out best testing tool for my project. I have narrowed down my requirements to two tools NUNIT and VSTS unit. But I have used neither and I have to use only one of them....
2
by: JohnGoogle | last post by:
Hi, I'm a newbie so sorry if there is a simple answer to this! I'm using C# in Visual Studio Express at the moment. I've downloaded NUnit v 2.2.8 and can load and run the tests they supply...
5
by: Mark | last post by:
Assume .NET 1.X and VS 2003 with NUnit. If you put the unit tests in a different project, you can't test private or internal methods or classes. We could put our unit tests in the same project,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.