473,507 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to unit test a Dataset?

Hi.

I have written unit tests for my helper classes that return simple
values as strings or integers. Now I need to test the methods that
deal with DataSets and DataTables. Is there any special issues when
running these kind of tests? I ask this because if I create a DataSet
from scratch reproducing the desired structure and compare this to the
real DataSet I got from running my helper class, the Assert.AreEqual
method says me they are not equal! But both DataSets have the same
tables, columns and number of records.

Any help would be greatly appreciated !

Regards,
RBScheer
Jul 13 '08 #1
1 2618
On Jul 13, 3:04*pm, RBScheer <rbsch...@my-deja.comwrote:
Hi.

I have written unit tests for my helper classes that return simple
values as strings or integers. Now I need to test the methods that
deal with DataSets and DataTables. Is there any special issues when
running these kind of tests? I ask this because if I create a DataSet
from scratch reproducing the desired structure and compare this to the
real DataSet I got from running my helper class, the Assert.AreEqual
method says me they are not equal! But both DataSets have the same
tables, columns and number of records.

Any help would be greatly appreciated !

Regards,
RBScheer
That's a really good question, and not one that I really know an
answer for. If it were me, I'd test as much functionality as you can,
say making sure that you have rows, or a certain number of rows, and
that you have the appropriate columns. You could even spot check the
values of a few of the data rows if you like. The other option would
be to loop through the actual dataset members and compare them with
the expected dataset using Assert.IsTrue(...). That way if any of the
members don't match, the Assert.IsTrue would fail. To be honest, I'm
not sure if I like either method, but at least some coverage is better
than no coverage.

And just to be a pain, why is you are writing your tests after the
code? IMO, you should be doing it the other way around :-)

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jul 13 '08 #2

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

Similar topics

14
2709
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
6
2677
by: Ben Finney | last post by:
Howdy all, Summary: I'm looking for idioms in unit tests for factoring out repetitive iteration over test data. I explain my current practice, and why it's unsatisfactory. When following...
72
5157
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
6
1578
by: Dick | last post by:
I’d appreciate some advice regarding unit tests. My questions are general in nature but (as usual) best conveyed via a (simplified) example: I have a table that contains two columns – the...
5
6491
by: shuisheng | last post by:
Dear All, I was told that unit test is a powerful tool for progamming. If I am writing a GUI code, is it possible to still using unit test? I have a little experience in using unittest++. But...
1
1786
by: rich_sposato | last post by:
I released version 2.0 of C++ Unit Test Library. You can download it from SourceForget.Net at http://sourceforge.net/projects/cppunittest/ .. I wrote this unit test library because other unit...
27
2516
by: brad | last post by:
Does anyone else feel that unittesting is too much work? Not in general, just the official unittest module for small to medium sized projects? It seems easier to write some quick methods that are...
5
2229
by: Ben Finney | last post by:
Howdy all, PEP 299 <URL:http://www.python.org/dev/peps/pep-0299details an enhancement for entry points to Python programs: a module attribute (named '__main__') that will be automatically called...
1
2329
by: RBScheer | last post by:
Hi. I have written unit tests for my helper classes that return simple values as strings or integers. Now I need to test the methods that deal with DataSets and DataTables. Is there any special...
0
7221
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
7313
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,...
1
7029
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
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.