165k views
1 vote
Consider the following line of code: if (x < 12 || (r – 3 > 12)) Write three valid mutants of this ground string (based on the rules of the Java/C# language), followed by three invalid mutants. You must use a different mutant operator for each mutant you create – list the abbreviation for the operator used next to each line (for example, write "ROR" if you used a Relational Operator Replacement).

1 Answer

3 votes

Answer:

See explaination

Step-by-step explanation:

Mutation Testing:

Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors. It is a type of White Box Testing which is mainly used for Unit Testing. The changes in the mutant program are kept extremely small, so it does not affect the overall objective of the program.

We say a mutant is valid if it is syntactically correct. We say a mutant is useful if, in addition to being valid, its behavior differs from the behavior of the original program for no more than a small subset of program test cases.

VALID MUTANTS

1. if (x < 12 && (r – 3 > 12)) LOR

2. if (x < 12 || (r – 3 < 12)) ROR

3. if (x < 12 || (x – 3 < 12)) IVR

INVALID MUTANTS

1. if (x < 12 ||(r – 3 > 12) UPR

2. if (x < 12 (r – 3 < 12)) MLO

3. (x < 12 || (x – 3 < 12)) CSM

Note:

LOR: LOGICAL OPERATOR REPLACEMENT

ROR: RELATIONAL OPERATOR REPLACEMENT

IVR: INVALID VARIABLE REPLACEMENT

UPR: UNBALENCED PARANTHISIS REPLACEMENT

MLO: MISSING LOGICAL OPERATOR REPLACEMENT

CSM: CONTROL OPERATOR MISSING REPLACEMEN