ALERT

[LAST CHANCE] Data Layer: Modern Business, Defined

Mutation Testing

Definition - What does Mutation Testing mean?

Mutation testing is a method of software testing in which program or source code is deliberately manipulated, followed by suite of testing against the mutated code. The mutations introduced to source code are designed to imitate common programming errors. A good unit test suite typically detects the program mutations and fails automatically.

Mutation testing is used on many different platforms, including Java, C++, C# and Ruby.

Techopedia explains Mutation Testing

Mutation testing is a simple but ingenious method used to validate source code correctness and the testing process. The concept was first coined by Richard Lipton in 1971, and there has been a surge of interest since that time.

Mutation testing's working mechanism is simple and straightforward. A piece of source code encompassing all unit tests is selected. After verifying all positive testing for a given source code, a mutation is introduced into the program.

The degree of mutation applied to a given code block may vary. A common mutation testing implementation involves replacing a logical operator with its inverse. For example, operator "! =" is used in place of "= =." In some cases, mutation involves rearranging lines to change the execution order or even deleting a few lines of code. Complex mutation testing levels may result in compilation errors.

Once a program is modified, a suite of unit tests are executed against the mutated code. The mutated code passes or fails the unit test, depending on the testing quality. A well-written unit test must detect mutated code errors, resulting in failure. A unit test that fails to detect code errors may require a rewrite.

Mutation testing facilitates the following advantages:
  • Program code fault identification
  • Effective test case development
  • Detection of loopholes in test data
  • Improved software program quality
  • Elimination of code ambiguity

Disadvantages of mutation testing include:

  • Difficult implementation of complex mutations
  • Expensive and time-consuming
  • Requires skilled testers with programming knowledge

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources
The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.