A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ropensci/mutant below:

sckott/mutant: mutation testing for R

mutant - mutation testing

(wikipedia: mutation testing vs. fuzzing)

remotes::install_github("sckott/astr", "sckott/mutant")

As of this writing (2020-05-18) ...

# path to an R package with working tests in tests/
path <- "../randgeo/"
## collect fxns into an environment
env <- collect_fxns(path)
ls.str(env)
## make pkg map for later
pkgmap <- make_pkg_map(path)
## parse fxns with getParseData
# fxns <- parse_fxns(env)
## mutate something
mut_fxns <- mutate(as.list(env))
# what fxn was mutated?
which(vapply(mut_fxns, function(x) attr(x, "mutated"), logical(1)))
## write a new package with test suite to a tempdir
new_fxns <- make_fxns(mut_fxns)
newpath <- write_mutated_pkg(pkg_path = path, fxns = new_fxns, map = pkgmap)
## run test suite & collect diagnostics
mutout <- mutation_test(newpath)
# mutout
dplyr::select(data.frame(mutout), file, context, test, nb, failed, skipped, error, warning, passed)

This will all be internal code however - only exposing probably a few functions to users to run mutation testing, do something with results, etc.

brainstorming high level steps:

  1. map input package api
  2. generate mutants
  3. put all mutants in a queue (#2)
  4. test all mutants - pull jobs from the queue until all are done
  5. collate results, write to disk

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4