views:

359

answers:

9

Is anyone aware of any legal precedents where the lack of unit testing in an application has lost someone a case Or where someone has not been deemed negligent despite a lack of unit testing in an application. Is there any highly regarded alternative to unit-testing that enables programmers to objectively demonstrate a committment to software quality.

Edit: For example in medicine you can use in your defence that your approach is one that is regarded as acceptable by a substantial and well regarded group of other doctors.

+7  A: 

Unit testing is only a (very valid) alternative to test your code, it can't and could not be a legal requirement.

For example, you could prove some properties of a piece of code using a denotational semantic and some techniques that found their justification on well-founded relations, complete partial orders and fixed-point theorems.

akappa
Your answer is a bit beyond me. I confess I was thinking more in terms of maintaining a bug list and providing prompt bug fixes as an approach
jjb
The point is: surely you have to take care of the quality of the application, but why you *have* to provide a test suite?There are so many techniques that can give to you some insurances over the code quality...
akappa
+9  A: 

Legal is between you and whoever will pay for your software

If the contract said that you will do unit testing and you don't, then you're liable. It depends on every software and every agreement you make. When I buy Windows for critical software applications (laugh, laugh, it DOES happen), no one makes sure they unit tested everything

Eric
The customer isn't expected to know about unit-testing that's the programmer's job. The customer is possibly legally entitled to expect that the programmer will do the job in a way that other programming experts would endorse
jjb
Usinf medicine as an analogy, a patient isn't expected to know what tests a doctor will carry out and sign a contract detailing them.
jjb
+1  A: 

A lawyer could probably find out for you, but it would probably be expensive.

In general, there's no liability in software. How good or bad a thing this is is debatable, but I haven't found a piece of software yet that doesn't disclaim liability. (There was a case where a tax preparation program several years ago had a problem, and the company actually recompensed people to some extent. I know of no other exceptions.)

Liability would normally only come about in embedded software, since a manufacturer is frequently liable for the behavior of a device, and the software is part of the device. In that case, demonstrating that sound software engineering practices were used might be useful, but I would be astonished to learn that failing to use unit tests would be considered negligence. (There is also, at least in the US, a concept of "strict liability", which means somebody's completely to blame, no excuses possible. It's been applied to navigational maps, but if you want to know for what else you need to consult a lawyer or do your own research.)

So, what I'm saying is that I don't know of any cases, it sounds dubious to me, I am not a lawyer, and this is not legal advice.

David Thornley
I can't find any cases either but the problem is that in Europe developers are likely to be a an increased risk of litigation under new EU proposals.
jjb
A: 

Mate, if your a real developer getting paid you should already know why unit tests are valuable in maintaning quality and other merits. I certainly might not sue you but i would fire you. Asking such a question demonstrates that you are a cowboy without a professional attitude in deliverying a quality product.

mP
But if you were my customer then you could not fire me but you could sue me and I'm wondering how well you'd be able to persuade a jury that having no unit tests is negligent
jjb
If you have done a good job you wouldnt need to worry about asking such questions. It sounds like you have already done the deed and are getting nasty phone calls/letters or perhaps you are thinking is this customer dumb enough, so that i can take shortcuts...
mP
How do you know when you've done "a good job"?
jjb
When people worry about whether they could be sued, without the other side taking the initiative to sue, it probably means someone somewhere did something wrong.
mP
It must be great to write code with no bugs mP
jjb
must be great to be a crook.
mP
+1  A: 

Unit testing, in a formal sense, is a relatively new concept in software (I'd guess less than 10 years old). Prior to that, some components and modules were tested, but it was more important that the overall system be tested.

Generally, the law lags behind contemporary practices by quite awhile. It takes a long time for laws, codes, and cases to establish a precedent. It would be very surprising to me if there is any consensus in law about a relatively new approach like unit testing.

abelenky
It's possibly acceptable then in a legal sense to wait until a legal precedent is set before adopting unit-testing becomes a required practice
jjb
My argument is that it is not "acceptable", or "unacceptable" to do unit-testing on software. Rather that this is an unsettled area of software-law. You do NOT want to be the precedent-setting test-case. So, whether you choose unit-testing or another methodology, you should make sure your choices are defensible, if it comes to it.
abelenky
A: 

Unless you are IBM you. Should not be in a position to gurantee your code is defect free.as strange as it sounds this is the clients responsibility.

Toby Allen
A: 

I have worked on softwares which are critical applications that are installed only when the seller gives a buyer a complete list of testing done on the software and undersigned physically by the testers and the QA. this involves even if there is small unit which undergoes minor modification.

+1  A: 

User testing can be illegal in some cases (stackoverflow.com: what-legal-issues-surround-unit-testing-database-code-closed), because you can't allowed to do some things with personal data, for example in a database you wanted to include in your test.

In defense of a negligence lawsuit, an accused programmer might use extensive unit testing in his defense. If a contract specified unit testing, but none was conducted, then there would be cause for breach of contract.

Unit testing is not enough to reveal every possible fault, and there is not an ISO standard for it yet. A naive court might be convinced that it indicated neglect, but it is surely not founded upon a great body of legal precedent.

Good points there both about data confidentiality and about the lack of an ISO standard for unit testing
jjb
+1  A: 

Unit testing is a good idea in general, but the field of software engineering has a long way to go until it's a standard practice that people can be sued for not doing. There are many cases where unit tests are simply not appropriate. Unless it's explicitly mentioned in a contract, there shouldn't be an expectation that unit testing will be used for a product.

James Thompson
Where do you find out what the standard practices in programming are?
jjb