Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ask Question up vote2down votefavorite I learned white-box and black-box testing

ID: 3730391 • Letter: A

Question

Ask Question

up vote2down votefavorite

I learned white-box and black-box testing in terms of iterative functions. Now i need to do white-box and black-box testing of several recursive functions (in F#). take the following recursive algorithm for gcd:

For the white-box test: how exactly do i go about covering the different branches of the algorithm? Naively one could say there are two branches but when the function is called more than once the possible branches will obviously increase. Should i do testing with arguments which results in different amounts of recursive calls or how exactly do i determine which values to test with?

black-box: i get the general idea of black box testing. we should look at possible values we might want to call the function with without having knowledge of its inner workings. In this case i am just not sure which are values we might want to call it with. one way could be just to start with two values m and n for which gcd = 1 and then do the same for values m and for which gcd = 2 up to some gcd= n for some arbitrary number n. Is this how one is supposed to go about this?

Explanation / Answer

1.Whitebox testing:

All the branches need to be covered. In the case of recursive calls also, there is not
much speciality as the recursive calls have one end condition and the other is just the
call.All the error conditions need to be covered.The idea is we should consider all kind
of possible inputs and look at the code behaviour. example (m , n are equal), (m > n), (n<m)
(m = 0 , n > 0) , (n = 0 , m > 0), (m < 0, n < 0) etc. Many times , mnay situations are not
handled in the code , so that can be documented. With whitebox , we just need to cover the
path and how mnay times a function gets called is not going to be a significant parameter
but if we get a specific call in the recursion in which the code behaviour is erratic ,   then those inputs should be covered.

2. Blacbox testing:

This is a bit simpler, because here we just need to consider all the class of valid inputs
and all the class of invalid inputs. The values chosen should be normal values or boundary
conditions (if defined), error coditions (if defined).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote