Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Java Whitebox Testing

So yeah, I'm stuck on a homework problem...

Basically we have this piece of code

Code
public  String checkValues(int i, int j, int k)
{
     int match;

     if (!( (i>0) && (j>0) && (k>0) ))
       return "\nInvalid sides for triangle \n";
     else
       if ((i>=j+k) || (j>=k+i) || (k>=i+j))
         return "\nNot a triangle\n";
       else
       {
          match = 0;
          if (i==j)
            match = match + 1;
          if (j==k)
            match = match + 1;
          if (k==i)
            match = match + 1;
        
          if (match == 0)
            return "\nScalene triangle\n";
          else
            if (match == 1)
              return "\nIsoceles triangle\n";
            else
              return "\nequilateral triangle\n";
     }
  }
}

and the following task:

Attached to this specification is a copy of the code for a Java method. Your task is to design test cases to exercise the method using the Multiple Condition Coverage criteria.

You must produce the following documentation:

• The set of truth tables arising out of your analysis of the code;
• A completed Test Plan – see the notes.

I've never come accross testing like this before, only really done Blackbox D:

Can anyone help me out? :)
Do you have the answer to this? :)
(Feb 11, 2019 03:19 AM)anon123 Wrote:  Do you have the answer to this? :)

Dude, this is from 2014 and the account is closed. Please pay attention and don't necro-post.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by SIM-2015410Oct 26, 2015 07:53 AM 2 224 Oct 26, 2015 07:53 AM
Last Post: Remix
[Java] by President HolyFeb 8, 2014 11:48 AM 3 193 Feb 8, 2014 11:48 AM
Last Post: Knautschtabak
[Java] by CatchMeIfYouCanOct 23, 2012 12:53 PM 6 438 Oct 23, 2012 12:53 PM
Last Post: redpois0n