Found bug - need new test? or modify existing test?

J

Joe Van Dyk

So, I'm developing some software. It's still pretty early in
development. I have a bunch of tests for the software.

Say I come across a bug that exposes a boundry condition that I didn't
test for.

Should I=20

a. Modify the test that is responsible for that area of the code to
test for that extra condition.
b. Add a new test that duplicates everything of the test that
supposed to test that area correctly and also tests for the boundry
condition?

In my case, I have a function that's responsible for scanning a string like

"id: 1, x_pos: 23, y_pos: 34 | id: 2, x_pos: 34, y_pos: 34 | "

I was splitting the string at "|" and then doing a regex for id and so
on. But if there's a " | ", then the last thing String#split will
return is a space, and doing a regex on that space for /id:/ messes
things up. So either I could modify the test function to include that
extra " | " at the end, or have a new function that tests for that.
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top