I'm new to unit testing and I need some clarification. I want to test a class. When I create an instance of this class with the default constructor, I need to check 3 values and make sure they are initialised to the correct default values (for instance : a name property).
Do I have to code three tests (one for each value to test) or can I create one test for the default construction of the instance and check, in the same test, the 3 values ?
There is no good reason to test each value separately. Your "unit" consists of the class itself, I assume, and your unit test should verify the class as a whole. If there is something unique about the way values are accessed, then the test should take that into account. But if they're accessible as a group, go ahead. Your test also should include verification of the methods within the class, and should be structured so that all private methods are utilized during the test. If the class has any dependencies on other classes, make sure that you exercise them thoroughly. Ideally, you should also try testing error conditions; try things you never intended the class to do and check how gracefully it fails. Use out of range values, incorrect variable types, and edge-of-limit values if there are any limit tests required. As a general guide, try to imagine what the dumbest consumer of your class might attempt to do to it, then duplicate that in your test. We used to call that "dummy-proofing" before there was such a thing as formal unit testing, and it worked remarkably well.
"...putting all your eggs in one basket along with your bowling ball and gym clothes only gets you scrambled eggs and an extra laundry day... " - Jeffry J. Brickley
I am the CBOOP (Component Based Object Oriented Programming) developers team coordinator and group moderator on http://groups/yahoo.com/group/cboop
What's all about:
We intend to develop a new brand of distributed OS for PC-like computers and the tools to build it.
Although the main design part is basically finished - I'll post to the group a project DRAFT soon - we can use all the help we can get both for coding and for project refining.
For any details (of any kind), you can contact me by e-mail: Alexandrescu_Emil_Cristian@yahoo.co.uk
The big question is: will you help us?
Thancks for your time.
It is - and at the time I signaled that to its original poster.
I also told him that his so called CBOOP deepens a lot the old, classic OOP, so it is a new quality that emerged from his work; I sugested him to call it simply "COP" - Component Oriented Programming. But he is so modest, that he told me something like: "let's get this job done first; then we'll have a plenty of time to change it's name".
And it is preciselly his atitude that made me provide help both to design the OS and the compiler (not to mention the qualities of his ideeas).
For details about CBOOP I suggest you to follow the hyperlink:
Then go to the board called "New programming languages"
I am sorry that for the moment I can't provide many details about this project's stage - perhaps when you will join us as a member of our group... !?
Thancks for feed-back, but right now I have to leave - I am CBOOP-ing you know
And if that NDA thing prevents you from contributing to any OS development... why did youu replied to my postage then - since there is "OS" right in its title isn't it. I am literally puzzled. Please explain that to me.
Suppose I want an application which takes a source file and outputs its data members and functions.
Supposed to develop into a kind of class view explorer.
Regarding parsing the source file ....
should i go for using regular expressions rules for this parsing or
should i go for a language representation in context free grammer[CFG] and use the CFG rules for parsing
or is there any other possible ideas for source file parsing
I've got two open source projects running at the moment - just me on both of them. One is a reusable security/user management component, the other is an bookmark manager. In both cases, I've more or less finished up the data and business layer stuff without hassles .... but I'm stuck on the web user interface. My web design isnt the strongest, and I'd like to find someone who can a) take over the web UI side of my projects, and hopefully b) share ideas with. I prefer having at least two heads on a project - helps to keep things tighter.
If anyone is interested, drop me a line at firstname.lastname@example.org. You should be:
a) good at asp.net specifically
b) reasonably good at web styling (CSS etc)
c) in possession of at least some undertanding for OO concepts (I'll be handling most of the "backend" stuff, but you need to be able to code up against my stuff easily enough)
Appreciating open source ideals is definitely a bonus.
Hope to hear from someone out there
Last Visit: 10-Apr-20 10:17 Last Update: 10-Apr-20 10:17