Question

In: Computer Science

1) List the three steps of test driven development and explain, in detail, why these three...

1) List the three steps of test driven development and explain, in detail, why these three steps are used.
2) Explain why the order of the steps is so important.

3) For each of the following data types, explain what boundaries might be relevant to testing. Also, explain what values you would consider testing for parameters of this type. Justfiy your answers.

  • boolean
  • int
  • String
  • List
  • Optional
  • Point
  • Map

Solutions

Expert Solution

PART-1

1. Three steps of test driven development
A.
Red, B.Green ,C. Refactor

RED PHASE:-Create a test and make it fail

1.So basically the first step of this Red phase is to write unit test or any kind of test for our function and make sure that the test is short and simple, no much of complexity is required at this stage.

2.The second step is to increase the no. of lines in your code and write enough code so that it compiles.

3.Then, the third step is to Run the test and it should fail. By doing this you are basically making sure that the code your test is calling is the correct code.

GREEN PHASE:- Mandatory to pass the test using any method

1In this phase the first step is to write the code such that the test passes.

2 If the test passes then stop here, don't unnecessary increase your code lines.

3 Run the test again and watch it. Also this will result in green progress bar.

REFACTOR PHASE:-

1.Now is the time to remove unnecesary lines of code and keep the code more clean and efficient

2. If necessary make the design changes.

3. After each refactoring, rerun all the tests just to ensure that they all pass.

NOW, let us understand why do we use these steps:-

1. To improve the code quality
2.To improve application quality
3. To increase the developer's productivity
4.To help increase the scope of test coverage that is a higher test coverage

​​​​​​------------------------------------------------------------------------------------------------------------------------------------------------PART-2

The order of these steps is must as it is a very thoughtful strategy to follow these steps. Follwing them would ensure that you write the test cases for the code and you are also writing only that much of a code which you need to test.To some of us this might not make sense but adding extra unnecessary lines of code is not needed and unused and writing more lines but inefficient code just wastes our resources. Better is to write minimal and efficient lines.

---------------------------------------------------------------------------------------------------------------------------------------------------

PART-3

1.Boolean:-

1.It is one of the simplest data type so it should be checked for values like false or true OR '0' and '1' depending on the language. For some langauages checking true or 1 are same but as I mentioned this is completely language specific.

2.Int:-

1.The range of integer varies depending on language which your code is in so just check that range.

2.Make sure to test positive and negative integers separate.

3.Check the data type carefully and that it is not double or float.

3.String:-

1.So most important is white spaces in strings, be very careful handling them.
2.Make sure to be familiar with the use and limitation of strings in that language.

for eg:- for some files string ='abc' and "abc" are same but in some langauges this isn't the case.

4. List:-

1.Remove an Element from a List Inside a loop. Make sure you don't make this basic mistake.

2.It's always better to know the length of list in start.

3.Learn to wisely use hastables and hashmaps. As there is a difference in them.

6.Point:-

1.These are meant to represent a point on a two dimensional plane, so just check for the size of the matrix which is acceptable according to the code.

2.Make sure you check correctly for Row and Column limitation.

3.A bigger matrix could be troublesome.

7. Optional
1.Make sure you don't store a null object.
2.This data type is specific to the java version so check that.

8.Map:-

1. Check if duplicates are allowed in the type of map you are using because this might lead to an exception.


---------------------------------------------------------------------------------------------------------------------------------------------------


Related Solutions

List three control risk of ANZ, explain why, state in detail.
List three control risk of ANZ, explain why, state in detail.
1. Explain in a list of steps how the development of pesticide resistance in agricultural pests...
1. Explain in a list of steps how the development of pesticide resistance in agricultural pests (weeds, for example) occurs. List all the steps in the process, showing how this is an example of evolution by natural selection. Be as thorough and detailed as possible. 2.Briefly propose a policy or a practice that would reduce the problem of pesticide resistance (and still allow the use of pesticides). 3. Briefly (in 1-3 sentences) explain in biological evolutionary terms, why the policy...
List and explain in detail all the steps that will be performed to convert a logical...
List and explain in detail all the steps that will be performed to convert a logical address to physical address in the paging system?
Explain in a list of steps how the development of pesticide resistance in agricultural pests (weeds,...
Explain in a list of steps how the development of pesticide resistance in agricultural pests (weeds, for example) occurs. List all the steps in the process, showing how this is an example of evolution by natural selection. Be as thorough and detailed as possible.
Explain in detail a “Goodness-of-Fit” test and when and why this test would be used versus...
Explain in detail a “Goodness-of-Fit” test and when and why this test would be used versus any other analysis test.
List the 4 steps for assessing training and development needs.
List the 4 steps for assessing training and development needs.
Explain (in detail) the entire development of the limbs?
Explain (in detail) the entire development of the limbs?
what are three examples of a professional development plan? why is it important to network? list...
what are three examples of a professional development plan? why is it important to network? list 2 reasons
Question 3 (a) Give a description of the Test-Driven Development paradigm and provide details of two...
Question 3 (a) Give a description of the Test-Driven Development paradigm and provide details of two benefits. [6 marks] (b) Explain the difference between white-box testing and black-box testing. Provide an advantage and a disadvantage of white-box testing compared to black-box testing. [6 marks] (c) In black-box testing, it is usually infeasible to test all uses of an interface of a module. Therefore it is common to test only a subset of all possible input patterns. Describe a method by...
1. Give a brief detail of the physiologic steps to muscle contraction. Explain with support of...
1. Give a brief detail of the physiologic steps to muscle contraction. Explain with support of the appropriate chapters in your book. Using Patton, k. T; & Thiobodeau, G.A. (2015) Anatomy and physiology (8th ed.) Mosby. To provide pages numbers from the book.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT