Hack Forums
[Java] Java Whitebox Testing - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Java Whitebox Testing (/showthread.php?tid=4042141)



Java Whitebox Testing - L0G1T3CH - Feb 5, 2014

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? :)


RE: Java Whitebox Testing - anon123 - Feb 11, 2019

Do you have the answer to this? :)


RE: Java Whitebox Testing - Moonfall - Feb 11, 2019

(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.