473,569 Members | 2,453 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 2329
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
2726
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
2683
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 test-driven development, writing tests and then coding to satisfy them, I'll start with some of the simple tests for a class.
72
5188
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: http://geosoft.no/development/unittesting.html Thanks.
6
1584
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 name of a PC and the date/time that an event took place. I have a stored procedure that accepts two date arguments – a start date/time and an end...
5
6505
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 I can not work out a way to use it to test GUI code. Thanks a lot!
1
1789
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 test frameworks always lacked features I considered important. Some only provided output in certain formats, and I had no easy way to choose my own...
6
5676
by: Vyacheslav Maslov | last post by:
Hi all! I have many many many python unit test, which are used for testing some remote web service. The most important issue here is logging of test execution process and result. I strongly need following: 1. start/end timestamp for each test case (most important) 2. immediate report about exceptions (stacktrace) 3. it will be nice to...
27
2527
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 used when needed rather than building a program with integrated unittesting. I see the value of it (the official unittest that is)... especially...
5
2234
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 if the module is run as a program. The PEP has status "Rejected", citing backward-compatibility issues, and Guido's pronouncement that "It's not...
1
2630
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 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...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7678
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.