Here's my understanding as of now.
If I were writing a function
bool IsValidContact( Offerer objOfferer, Accepter objAccepter,
TermsAndConditi ons objTermsAndCond itions);
Before writing the function, I'd enlist all the conditions that must be
met for a contract to be valid. Something along the lines of:
1. There must be a valid offer made by an offerer;
2. There must be an unconditional, voluntary acceptance of the offer;
3. The offerer and accepter must be above the age of minority;
4. There must be a valid consideration (quid pro quo).
Though there are many more conditions, for the sake of simplicity, let
us stick to only the above four conditions.
Going from the above four, I'd translate them into code precondition
checks as follows:
1. Assert (objOfferer != null)
2. Assert (objAccepter.Ac ceptance.IsVolu ntary() &&
objAccepter.Acc eptance.IsUncon ditional())
3. Assert ((objOfferer.Ag e >= ObjLawOfMinorit y.MinimumAge) &&
((objAccepter.A ge >= ObjLawOfMinorit y.MinimumAge))
4. Assert (objTermsAndCon ditions.Conside ration.Value > 0)
These four would be the basis of unit tests after writing code.
In the implementation, I'd use Design By Contract (DBC) style
assertion:
if (objOfferer == null)
return false;
if (SomeOtherCondi tion Not Met)
return false;
Or I might use the straight-forward-one-return-path style design like,
if (objOfferer)
if (SomeOtherCondi tion Met)
return true;
After writing the implementation of the above function, I'd write unit
test scripts to test each of the above conditions. These would be
seperate functions that would call the function IsValidContract with
invalid and valid values against each of the above four conditions we
outlined.
Now, let me in on some terminology. Which of the above are test cases
and what is the unit tests here? 3 2079
None of these are tests at all, they are merely good validation of
parameters in the code. Testing means beating up the application with
valid and nonsense data input to verify the application is doing what it
is supposed to be doing. Typically, a unit test is performed by the
programmer, because he can step through the code while executing and
tracking values through the functions, and to verify he hasn't broken
anything else that was already working. Test cases are typically
performed by QA, or at least someone other than the programmer, ideally
with a written test plan and expected results.
Tom
Water Cooler v2 wrote: Here's my understanding as of now.
If I were writing a function
bool IsValidContact( Offerer objOfferer, Accepter objAccepter, TermsAndCondit ions objTermsAndCond itions);
Before writing the function, I'd enlist all the conditions that must be met for a contract to be valid. Something along the lines of:
1. There must be a valid offer made by an offerer; 2. There must be an unconditional, voluntary acceptance of the offer; 3. The offerer and accepter must be above the age of minority; 4. There must be a valid consideration (quid pro quo).
Though there are many more conditions, for the sake of simplicity, let us stick to only the above four conditions.
Going from the above four, I'd translate them into code precondition checks as follows:
1. Assert (objOfferer != null) 2. Assert (objAccepter.Ac ceptance.IsVolu ntary() && objAccepter.Ac ceptance.IsUnco nditional()) 3. Assert ((objOfferer.Ag e >= ObjLawOfMinorit y.MinimumAge) && ((objAccepter. Age >= ObjLawOfMinorit y.MinimumAge)) 4. Assert (objTermsAndCon ditions.Conside ration.Value > 0)
These four would be the basis of unit tests after writing code.
In the implementation, I'd use Design By Contract (DBC) style assertion:
if (objOfferer == null) return false;
if (SomeOtherCondi tion Not Met) return false; Or I might use the straight-forward-one-return-path style design like,
if (objOfferer) if (SomeOtherCondi tion Met) return true; After writing the implementation of the above function, I'd write unit test scripts to test each of the above conditions. These would be seperate functions that would call the function IsValidContract with invalid and valid values against each of the above four conditions we outlined.
Now, let me in on some terminology. Which of the above are test cases and what is the unit tests here?
He means unit testing with something like NUnit.
tomb wrote: None of these are tests at all, they are merely good validation of parameters in the code. Testing means beating up the application with valid and nonsense data input to verify the application is doing what it is supposed to be doing. Typically, a unit test is performed by the programmer, because he can step through the code while executing and tracking values through the functions, and to verify he hasn't broken anything else that was already working. Test cases are typically performed by QA, or at least someone other than the programmer, ideally with a written test plan and expected results.
Tom
Water Cooler v2 wrote:
Here's my understanding as of now.
If I were writing a function
bool IsValidContact( Offerer objOfferer, Accepter objAccepter, TermsAndConditi ons objTermsAndCond itions);
Before writing the function, I'd enlist all the conditions that must be met for a contract to be valid. Something along the lines of:
1. There must be a valid offer made by an offerer; 2. There must be an unconditional, voluntary acceptance of the offer; 3. The offerer and accepter must be above the age of minority; 4. There must be a valid consideration (quid pro quo).
Though there are many more conditions, for the sake of simplicity, let us stick to only the above four conditions.
Going from the above four, I'd translate them into code precondition checks as follows:
1. Assert (objOfferer != null) 2. Assert (objAccepter.Ac ceptance.IsVolu ntary() && objAccepter.Acc eptance.IsUncon ditional()) 3. Assert ((objOfferer.Ag e >= ObjLawOfMinorit y.MinimumAge) && ((objAccepter.A ge >= ObjLawOfMinorit y.MinimumAge)) 4. Assert (objTermsAndCon ditions.Conside ration.Value > 0)
These four would be the basis of unit tests after writing code.
In the implementation, I'd use Design By Contract (DBC) style assertion:
if (objOfferer == null) return false;
if (SomeOtherCondi tion Not Met) return false; Or I might use the straight-forward-one-return-path style design like,
if (objOfferer) if (SomeOtherCondi tion Met) return true; After writing the implementation of the above function, I'd write unit test scripts to test each of the above conditions. These would be seperate functions that would call the function IsValidContract with invalid and valid values against each of the above four conditions we outlined.
Now, let me in on some terminology. Which of the above are test cases and what is the unit tests here?
"Water Cooler v2" <wt*****@yahoo. com> wrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. . Before writing the function, I'd enlist all the conditions that must be met for a contract to be valid. Something along the lines of:
1. There must be a valid offer made by an offerer; 2. There must be an unconditional, voluntary acceptance of the offer; 3. The offerer and accepter must be above the age of minority; 4. There must be a valid consideration (quid pro quo).
What happens if the offer is zero? Negative? Extremely large? What if the
ages are null? Zero? >100? What if the consideration is unstated? Has no
intrinsic value you can detect? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christoph Zwerschke |
last post by:
In August 2001, there was a thread about the "Art of Unit Testing":
http://groups.google.com/group/comp.lang.python/browse_frm/thread/aa2bd17e7f995d05/71a29faf0a0485d5
Paul Moore asked the legitimate question why there is no hook for a
"global" fixture code that is run only once for the whole TestCase, as
opposed to the normal "setUp" and "tearDown" code that is run for every
single test in the TestCase. A "global fixture" would be...
|
by: |
last post by:
Hi!
I'm looking for unit-testing tools for .NET.
Somthing like Java has --> http://www.junit.org
regards,
gicio
|
by: Greg Roberts |
last post by:
Hi
I want to place the tests needed in the code using attributes. There seems
to be enough code snippets around
for me to cover this. e.g.
// Test cases, run these here on the function and check the result
|
by: Water Cooler v2 |
last post by:
Here's my understanding as of now.
If I were writing a function
bool IsValidContact(Offerer objOfferer, Accepter objAccepter,
TermsAndConditions objTermsAndConditions);
Before writing the function, I'd enlist all the conditions that must be
met for a contract to be valid. Something along the lines of:
|
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.
| |
by: nw |
last post by:
Hi,
I previously asked for suggestions on teaching testing in C++. Based
on some of the replies I received I decided that best way to proceed
would be to teach the students how they might write their own unit
test framework, and then in a lab session see if I can get them to
write their own. To give them an example I've created the following
UTF class (with a simple test program following). I would welcome and
suggestions on how anybody...
|
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 use logging module for output
|
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 when there's a
lot of source code. But this...
if len(x) != y:
sys.exit('...')
|
by: Brendan Miller |
last post by:
What would heavy python unit testers say is the best framework?
I've seen a few mentions that maybe the built in unittest framework
isn't that great. I've heard a couple of good things about py.test and
nose. Are there other options? Is there any kind of concensus about
the best, or at least how they stack up to each other?
Brendan
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
| |