A
Ark Khasin
Thank you folks for the fruitful discussion
Ark said:Thank you folks for the fruitful discussion
Since you asked... I expected a more substantial feedback (perhaps,Ian said:What was your conclusion?
Ark said:Since you asked... I expected a more substantial feedback (perhaps,
naively).
I've been heavily involved in a SIL 3 project with ARM and IAR EWARM 4.x
Our consultant-on-safety-stuff company spelled out requirements for unit
testing /documentation/ so that it could be accepted by TUumlautV - a
certifying agency. So we started looking for test automation tools that
would help /demonstrate/ test results including code/branch coverage.
The mantra is, if a branch is to never be executed, it shall not be inIan said:Well TDD done correctly will give you the required coverage, might be
interesting proving it to the certifying agency though (a branch won't
be there unless a test requires it).
Assuming that the test code itself must be reasonably dumb (so thatIan said:The last sentence is important, so I'll repeat it - the unit test are
built and run each time the module is compiled.
Ark said:Assuming that the test code itself must be reasonably dumb (so that
/its/ errors immediately stand out), that's not terribly realistic:
imagine a sweep over, say, "int24_t" range. One could only hope to run
automated tests overnight - on a long night .
Well there you would be wrong. I even use it for quick one offs,Ark said:The mantra is, if a branch is to never be executed, it shall not be in
the production code. If it is executable, I must demonstrate how I
exercised it.
BTW, I tend to doubt TDD can be followed in semi-research environment
where you churn out piles of code to see what works vs. how the plant
behaves etc. Of course there is some lightweight informal T but none
documented. Once you found a decent solution, you got a fair amount of
code that needs, aside from bug finding/fixing, only error conditions
handling for productizing. At this point, T is already way behind D.
Or I must be missing something here...
Ark said:The mantra is, if a branch is to never be executed, it shall not be in
the production code. If it is executable, I must demonstrate how I
exercised it.
Ark Khasin said:Assuming that the test code itself must be reasonably dumb (so that
/its/ errors immediately stand out), that's not terribly realistic:
imagine a sweep over, say, "int24_t" range. One could only hope to run
automated tests overnight - on a long night .
Ian said:Ark Khasin wrote:
Well there you would be wrong. I even use it for quick one offs,
because it helps me go faster. The time saved not having to debug more
than justifies the process.
Ian said:Well TDD done correctly will give you the required coverage, might be
interesting proving it to the certifying agency though
Ark said:Ian Collins wrote:
Assuming that the test code itself must be reasonably dumb (so that /its/
errors immediately stand out), that's not terribly realistic: imagine a
sweep over, say, "int24_t" range. One could only hope to run automated
tests overnight - on a long night .
A certifying agency's stamp assures a Bhopal or Chernobyl plant managerPhlip said:Put the test into FIT, and let the certifying agency change the input
variables and watch the output responses change.
Oh, are you going to say there are "certifying agencies" out there which
_don't_ expect literate acceptance tests to cover their requirements??
Sure explains KBR, huh? (-;
[If we agree that a test is a contraption to check if the code works asPhlip said:Sounds like TDD.
Ian, you are responding to the straw-person argument, "Projects that use TDD
only ever write any tests before the tested code."
They don't. Now let's hear why these "research" environments are _allowed_
to write code without a failing test, first!
Ark Khasin said:Assuming that the test code itself must be reasonably dumb (so that
/its/ errors immediately stand out), that's not terribly realistic:
imagine a sweep over, say, "int24_t" range. One could only hope to run
automated tests overnight - on a long night .
Phlip said:Ian, you are responding to the straw-person argument, "Projects that use
TDD only ever write any tests before the tested code."
They don't. Now let's hear why these "research" environments are _allowed_
to write code without a failing test, first!
Ark said:[If we agree that a test is a contraption to check if the code works as
expected:]
If we don't know what to expect ("research"), we cannot write a test. [Or
again I am missing something]
E.g. if I'm writing a version control system, I know exactly what _has_ to
happen, and I can write the tests.
If e.g. I'm writing a monitoring code for the car's wheel speed sensors, I
may have a rock solid idea that e.g. whatever the speeds, the wheels
always remain in the vertices of a rectangle of the original size. Enter
sensor noise, wheel spinning, tire inflation and what not. I need lots of
code just to study what's going on before I can arrive at a sensible
algorithm.
Everett said:Is it really necessary to test all 2**24 values? It would seem that
testing the minimum, maximum, zero, and some representative values in
between would suffice. The "representative values" should be numerically
irrational (pi and e are good, for instance) so as to catch cases of
certain bits not being handled properly; 1 and 2 are not good choices
although they need to work properly as well.
In the area of branch testing, one has to test loops for proper
termination. [I just found some bugs last evening that involved
some simple counting loops that didn't terminate due to doing a
check for <0 on an unsigned value -- oops.]
Everett said:Have you ever worked in a product R&D environment?
A lot of concepts
are taken for a test drive without ever seeing the light of day outside
the lab. If the product does make it out the door, the original
concept proving/testing work is probably a very small portion of the
final product. You want to spend a lot of time and effort producing
more formalized testing processes for something that has a very low
probability of ever being used in a production environment?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.