All Projects → HiveRunner → mutant-swarm

HiveRunner / mutant-swarm

Licence: Apache-2.0 License
Mutation testing framework and code coverage for Hive SQL

Programming Languages

java
68154 projects - #9 most used programming language
StringTemplate
18 projects
CSS
56736 projects

Projects that are alternatives of or similar to mutant-swarm

frankencover.it
Code coverage for iOS and OSX.
Stars: ✭ 102 (+410%)
Mutual labels:  coverage, coverage-report, code-coverage
Pitest
State of the art mutation testing system for the JVM
Stars: ✭ 1,185 (+5825%)
Mutual labels:  coverage, mutation-testing, junit
Bashcov
Code coverage tool for Bash
Stars: ✭ 113 (+465%)
Mutual labels:  coverage, coverage-report, code-coverage
react-testing-mocha-chai-enzyme
A solid test setup for React components with Mocha, Chai, Sinon, Enzyme in a Webpack/Babel application.
Stars: ✭ 48 (+140%)
Mutual labels:  coverage, coverage-report
HiveRunner
An Open Source unit test framework for Hive queries based on JUnit 4 and 5
Stars: ✭ 244 (+1120%)
Mutual labels:  hive, junit
jacoco-badge-generator
Coverage badges, and pull request coverage checks, from JaCoCo reports in GitHub Actions
Stars: ✭ 53 (+165%)
Mutual labels:  coverage, coverage-report
octocov
octocov is a toolkit for collecting code metrics (code coverage, code to test ratio and test execution time).
Stars: ✭ 191 (+855%)
Mutual labels:  coverage-report, code-coverage
enterprise
Code coverage done right.® On-premise enterprise version.
Stars: ✭ 63 (+215%)
Mutual labels:  coverage, coverage-report
javadoc-coverage
A Doclet to generate JavaDoc coverage reports ☕️🧪📗
Stars: ✭ 23 (+15%)
Mutual labels:  coverage, coverage-report
tarpaulin
📈 GitHub Action for code coverage reporting with tarpaulin
Stars: ✭ 69 (+245%)
Mutual labels:  coverage, code-coverage
unitest
🌎 Seamless node and browser unit testing with code coverage
Stars: ✭ 28 (+40%)
Mutual labels:  coverage, coverage-report
ruby-codacy-coverage
DEPRECATED Post coverage results to Codacy
Stars: ✭ 12 (-40%)
Mutual labels:  coverage, code-coverage
code-coverage-action
GitHub Action that generates code coverage reports
Stars: ✭ 28 (+40%)
Mutual labels:  coverage, code-coverage
travis-ci-tutorial-java
Just to learn how to use travis-ci in a java project!
Stars: ✭ 38 (+90%)
Mutual labels:  coverage, junit
cactoos-matchers
Elegant object-oriented hamcrest matchers
Stars: ✭ 30 (+50%)
Mutual labels:  junit, unit-test
torchjs
Test framework to light up the world.
Stars: ✭ 40 (+100%)
Mutual labels:  coverage, unit-test
mutatest
Python mutation testing: test your tests! Safely run mutation trials without source code modifications and see what will get past your test suite.
Stars: ✭ 50 (+150%)
Mutual labels:  mutation-testing, unit-test
behat-code-coverage
Generate Code Coverage reports for Behat tests
Stars: ✭ 48 (+140%)
Mutual labels:  coverage-report, code-coverage
jacoco-report
Github action that publishes the JaCoCo report as a comment in the Pull Request
Stars: ✭ 31 (+55%)
Mutual labels:  coverage, code-coverage
grcov
📈 GitHub Action for code coverage reporting with grcov
Stars: ✭ 96 (+380%)
Mutual labels:  coverage, code-coverage

Picture of a mutated bee and title text that reads 'Mutant Swarm'

Maven Central Build License

Overview

Mutant Swarm is a mutation testing framework for Hive SQL built on top of HiveRunner. It enables the identification of areas of SQL code bases that have poor test coverage and consequently may be a source of operational risk.

Usage

You can enable Mutant Swarm on your HiveRunner test suites like so:

  1. Add mutant-swarm dependency
  2. Replace the runner or the extension
  3. Execute test suite
  4. Locate and view report

Dependency

<dependency>
  <groupId>io.github.hiverunner</groupId>
  <artifactId>mutant-swarm</artifactId>
  <version>1.2.0</version>   
  <scope>test</scope>
</dependency>

JUnit4

HiveRunner JUnit4 tests suites use the com.klarna.hiverunner.StandaloneHiveRunner JUnit4 runner implementation. To enable the Mutant Swarm runner you simply need to replace this with the com.hotels.mutantswarm.MutantSwarmRunner implementation:

@RunWith(MutantSwarmRunner.class)
public class HiveSqlEtlTest {
    ...
  @Test
    ...
}

JUnit5

To use JUnit5 and the extension model, you will need to have at least version 1.1.0 of Mutant Swarm.

HiveRunner JUnit5 tests classes use the com.klarna.hiverunner.HiveRunnerExtension JUnit5 extension implementation. To enable the Mutant Swarm extension you simply need to replace this with the com.hotels.mutantswarm.MutantSwarmExtension implementation:

@ExtendWith(MutantSwarmExtension.class)
public class HiveSqlEtlTest {
    ...
  @MutantSwarmTest
    ...
}

You also need to annotate the tests that you want run with Mutant Swarm with @MutantSwarmTest instead of @Test.

Locate and view report

Mutant Swarm currently writes out an HTML report to the target/mutant-swarm-reports folder of your project. The name of the file will be the test class name and its package. So, for example, if we are testing the class MutantSwarmRunnerTest in the package com.hotels.mutantswarm, the report will be called com.hotels.mutantswarm.MutantSwarmRunnerTest_SWARM.html. That way, we will get a different report for each test class.

Picture of a report generated by mutant swarm

Motivation

Despite fast-paced innovation in the data processing domain, code developed with SQL-based languages forms a significant part of most organisations' data processing pipelines and ETL applications. The fact that SQL-based engines are often added to even cutting edge frameworks suggests that this trend is set to continue; SQL is easy to learn, is powerful, and has a huge developer base.

However, it has lagged behind the continuous improvements made in the areas of software development best practice and test automation. Unlike code developed in other languages, SQL has limited options for fine-grained automated testing and the analysis of code and test quality. While SQL enables rapid development of critical business systems, it simultaneously leads to code bases that are impervious to testing, introducing potential failure risks that would be deemed unacceptable in any other software development domain.

Mutant Swarm is an important component in a broad approach to redress the balance. It is a tool that identifies deficiencies in test suites that target SQL code, exposing areas of potentially critical business logic that have poor test coverage. By understanding where these deficiencies lie one can begin to evaluate the risk posed, and make informed decisions on where best to focus test development effort.

How it works

Picture of the system diagram for how mutant swarm works

  1. Run tests and report
  2. Sequence SQL genes
  3. Generate mutant scripts
  4. Run tests for each mutant
  5. Mutation Report

Environment

Mutant Swarm specifically targets code written for the Apache Hive SQL engine, however, the principles it employs could be applied to any SQL engine. The tool works in conjunction with HiveRunner, a unit testing framework for Hive SQL, specifically performing analyses on tests suites developed with it. Generally it is recommended that code bases be modularised. However, coverage insights are arguably even more pertinent for complex and monolithic queries.

Limitations and future work

  • Execution time is effectively proportional to the product of the number test cases and the size of the SQL code base under test.
  • Project currently includes only a small set of gene matchers and possible mutations, this limits the scope of coverage measurement.
  • The responsibility for unit test execution and mutation testing is currently conflated.
  • If we want to use JUnit5, we have to change every @Test annotation in the test class with @MutantSwarmTest. Ideally, we would like to simply place the @MutantSwarmTest annotation at the top of the code and leave the @Test annotations unchanged. We have raised this issue on Stack Overflow.

Contact

Mailing List

If you would like to ask any questions about or discuss MutantSwarm please do so on the HiveRunner mailing list at

https://groups.google.com/forum/#!forum/hive-runner-user

Credits

This project was initially developed and maintained by Hotels.com before moving to the HiveRunner organisation on GitHub.

Conceived and designed by Elliot West, developed by Jay Green-Stevens with ongoing development by Adrian Woodhead and Sara Rubio Hermosa.

Legal

Copyright 2021 The HiveRunner Contributors Copyright 2018-2021 Expedia, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].