Design by Contract - black box testing
Hello all,
Desperate reply needed: trying to do some testing for a project using the above types of testing. But don't know where to start "googled" it and found some sites. Anyone know any other websites to help/teach how to do the testing methods above? Looking for a step by step plan or method, or something like that.
All help will be appreciated. thanks.
p.s. didn't know where else to post this on the forum, sorry.
[449 byte] By [
abshirf2a] at [2007-11-26 21:37:56]

http://jcontractor.sourceforge.net/ http://approximity.com/testing/httpunit.html
Thanks for the reply! :)
BUT i've seen both websites! I've been searching for a while now. I have tons of explanations of design by contract etc...
What i want is maybe examples of how to actually do it, i have a rough idea but i don't know if its correct so i just want to see if i am on the right track.
Thanks for anymore replies. :)
When Google fails you, [url= http://www.amazon.com/Design-Contract-Example-Richard-Mitchell/dp/0201634600]dead trees[/url] may avail.
lol, this certainly worked. But it costs money also its going to take me time to get. So i want something free and quick from the internet. :)
Okay. So you read the book "Juggling for Dummies", but you still can't juggle. There's no remedy for that beyond throwing the balls in the air and practicing until you can.
> But it costs money also its going to take me time to
> get. So i want something free and quick from the
> internet. :)
10 Go to Barnes & Noble
20 Buy 1 cup of coffee
30 Read books
40 GOTO 20
I don't feel bad about it, though. I think on Java books alone, I've put one of the B&N Execs' kids through college.
> 10 Go to Barnes & Noble> 20 Buy 1 cup of coffee> 30 Read books> 40 GOTO 20And here I thought that BASIC programming I did in 11th grade was nevergoing to come in handy again.
> And here I thought that BASIC programming I did in> 11th grade was never> going to come in handy again.*Hastily hits the switch and puts the Commodore VIC-20 back in the closet*
Thanks for the sarcasm people, but i need web site links! :)I've read tons already, but only about what design by contract is, its advantages over defensive methods.....etcI just can't find examples on the Internet!
[url= http://www.google.com/search?num=100&hl=en&q=%22design+by+contract%22+examples+%2Bjava&btnG=Search]Ask and you shall receive[/url]. I count 100 on this page.
So I typed "design by contract examples" into Google and this was the first link that came back:
http://archive.eiffel.com/doc/manuals/technology/contract/
It does indeed contain some examples. And kevjava already referenced the second link that came back. Also on the first page of links was this JavaWorld article:
http://www.javaworld.com/javaworld/jw-02-2001/jw-0216-cooltools.html
It has examples too. I'm sure there are more...
Nice links but I've seen them and the examples are not that great.
Also the style of using design by contract is different for the web pages you have given.
One has the @pre, @post and @inv the other has this which i dont know what it is:
put (x: ELEMENT; key: STRING) is
-- Insert x so that it will be retrievable through key.
require
count <= capacity
not key.empty
do
... Some insertion algorithm ...
ensure
has (x)
item (key) = x
count = old count + 1
end
Alos i think eiffel was the company that came up with DBC. That site is talking about its own software.
I think i'm going to have to get a book, someone suggested one previously. aaahh, so much for google.
p.s. i'm not being picky if you think i am being picky. :)
Texas Instruments TI-99 / 4A was a great computer. Much more bestest than Coomadore 64...
You seem to think that Design By Contract is a language with a specific syntax. If you think that then you definitely didn't spend enough time reading the information you already saw. So don't be in such a **** hurry. Learn the topic properly and stop demanding that there should be a way for you to already know it.
Now now, lets not swear and lets be civil.
"You seem to think that Design By Contract is a language with a specific syntax. " - i don't think its language but doesn't it have a common syntax?!
I have to be in a hurry, project due in 2 weeks. Time waits for no man. :)
Also I'm not demanding anything, I'm asking something.
It's strongly associated with Eiffel, but I see you've already got that link (hint, hint)
lol, i've learnt something. :)
Sorry if you've already seen this, but you could also take a look at dbc in Nice (which unfortunately no longer seems to be actively developed): http://nice.sourceforge.net/manual.html#contracts.
You also may want to to look at pre and post conditions in object constraint language in UML, which is another take on design by contract.
At the other extreme of elegance to UML, many programs in functional languages such as ML, Haskell and scala are nothing more than a declaration of the mapping of pre-conditions to post conditions, eg: http://www.scala-lang.org/docu/examples/files/patterns.html . This pattern based programming is not quite design by contract, as it doesn't specify invariants or exclusions explicitly, but is related.
Apart from the fact that you have to write the code twice if you're using an imperative language, one big problem with design by contract is composability in multithreaded shared memory systems. If the pre-conditions change in a separate thread but your thread produces the post-conditions related to the conditions on entry of the procedure, you have a breach of the contract; most languages don't provide a sufficiently composable memory model. Eiffel solves this by using an object level mutex, gaining mutexs on the receiver object and all arguments of a call, preventing more than one thread processing a given object. AFAIK Eiffel's approach prevents multi-reader single-writer queues and other such common concurrent patterns. Much modern research is given to using multi-threaded and lock-free objects, which allows multiprocessing without blocking; these tend to express true invariants rather than pre- and post-conditions, though there seems to be some similarity between software transactional memory approaches and design by contract - STM actually tests the conditions and rolls-back if changed, so would allow multi-reader scenarios without breaking contracts. Like all magic, it's tricky to implement.
Pete
