Skip to main content

Why TDD is very important and suitable for SCRUM Development Team?

Last post 05:01 am July 15, 2015 by Anonymous
No replies yet
05:01 am July 15, 2015

If you are preparing for PSD 1 assessment and do not know what Code Coverage and TDD are, here you are:
https://www.scrum.org/Resources/PSD-Glossary

Yesterday, an junior developer asked me for help due to required coverage not being met. His questions:
Why TDD is very important and suitable for SCRUM?
Is it feasible to expect 100% code coverage?

Why TDD is very important and suitable for SCRUM?
First of all, it’s make sense to convert each user story to a test case. A test case should be defined to simulate users’ action, behavior, requirement, etc. When executable code is created to make the test pass subsequently, that mean pieces of code is almost ready.

Secondly, TDD will increase transparency of your code.
Basically, the Code Coverage should be 100% if you use TDD. Test coverage is a useful tool for finding untested parts of a codebase. Test coverage is of little use as a numeric statement of how good your tests are, but it can help you finding duplicated or unused code which always untested.

Sometime, untested code is due to your mistake on choosing code statements, expressions, scheme, etc.

For example, WHILE loop and FOR loop, those are very common sense for developers.
Really?

If there were lines of code:

for (int I = 0; i<5; i++)
{
bool success = DoSomething();
If (success)
Break;
}

If it was so lucky to get a success result at first try, what it would mean?
Yes, “i++” would be untested.

Let’s refactor it.

Int RetryTimes = 5;
int count = 0;
bool success=false;
while ((!success) &&(count<RetryTimes))
{
success = DoSomething();
}

Each line of code should be tested.

What’s the different? Just for high code coverage?

It help us to think about the different between FOR loop and WHILE loop.
FOR is for “Index Range” while you can break or continue according to predefined conditions.
WHILE is for “Condition” while you can set the maximum loops.

Just for your reference.


By posting on our forums you are agreeing to our Terms of Use.

Please note that the first and last name from your Scrum.org member profile will be displayed next to any topic or comment you post on the forums. For privacy concerns, we cannot allow you to post email addresses. All user-submitted content on our Forums may be subject to deletion if it is found to be in violation of our Terms of Use. Scrum.org does not endorse user-submitted content or the content of links to any third-party websites.

Terms of Use

Scrum.org may, at its discretion, remove any post that it deems unsuitable for these forums. Unsuitable post content includes, but is not limited to, Scrum.org Professional-level assessment questions and answers, profanity, insults, racism or sexually explicit content. Using our forum as a platform for the marketing and solicitation of products or services is also prohibited. Forum members who post content deemed unsuitable by Scrum.org may have their access revoked at any time, without warning. Scrum.org may, but is not obliged to, monitor submissions.