pitest

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

README

Pitest

Pitest must be run with the -Dfeatures="+EXPORT" flag which exports the mutated class files. This is required because Marv will decompile these class files to construct each mutants replacement string.

mvn org.pitest:pitest-maven:mutationCoverage -Dfeatures="+EXPORT

[!NOTE] The replacement strings (inserted lines) that Marv produces are correct, however they are occasionally flanked by incorrectly formatted deleted lines due to formatting differences between the source code and decompiled class code.

A new Marv Pitest configuration can be created by running the marv init -f Pitest command.

Decompilers

Marv has a range of decompiler options that can be used with to construct the Pitest mutant replacement strings. They are listed below.

[!CAUTION] The garlic decompiler is currently unstable and using it could cause some mutants to be skipped due to a segmentation fault that occurs when running garlic on some class files.

For installation location see Installation - Libraries

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMutations

type FileMutations map[string][]*Mutation

FileMutations stores all mutants of the same file against the string of the full file path.

type Mutation

type Mutation struct {
	Detected          bool             `xml:"detected,attr"`
	Status            mutations.Status `xml:"status,attr"`
	NumTestsRun       int              `xml:"numberOfTestsRun,attr"`
	SourceFile        string           `xml:"sourceFile"`
	MutatedClass      string           `xml:"mutatedClass"`
	MutatedMethod     string           `xml:"mutatedMethod"`
	MethodDescription string           `xml:"methodDescription"`
	LineNumber        int              `xml:"lineNumber"`
	Mutator           string           `xml:"mutator"`
	KillingTest       string           `xml:"killingTest"`
	Description       string           `xml:"description"`
	MutationIndex     int              // NOTE: used to determine which mutants to decompile. Not present in XML.
}

Mutation is a struct that can accept the pitest xml output.

func (*Mutation) MutantExportDir

func (m *Mutation) MutantExportDir() string

func (*Mutation) MutatedClassPath

func (m *Mutation) MutatedClassPath() string

func (*Mutation) SourceClassPath

func (m *Mutation) SourceClassPath() string

func (*Mutation) SourceCodePath

func (m *Mutation) SourceCodePath() string

type PitXML

type PitXML struct {
	XMLName   xml.Name    `xml:"mutations"`
	Mutations []*Mutation `xml:"mutation"`
}

type Pitest

type Pitest struct {
	// contains filtered or unexported fields
}

Pitest is the Framework object for the pitest library.

func NewPitest

func NewPitest() *Pitest

func (*Pitest) LoadResults

func (p *Pitest) LoadResults() error

func (*Pitest) Meta

func (p *Pitest) Meta() *fwlib.Meta

func (*Pitest) Mutations

func (p *Pitest) Mutations() mutations.Mutations

func (*Pitest) ReadLines

func (p *Pitest) ReadLines(file string) ([]string, error)

func (*Pitest) SetDecompiler

func (p *Pitest) SetDecompiler()

func (*Pitest) TransformResults

func (p *Pitest) TransformResults() error

func (*Pitest) Yaml

func (p *Pitest) Yaml() fwlib.FWConfig

type YamlConfig

type YamlConfig struct {
	XmlPath      string `yaml:"xml-path"`
	SrcCodePath  string `yaml:"src-code-path"`
	SrcClassPath string `yaml:"src-class-path"`
	MutClassPath string `yaml:"mut-class-path"`
	Decompiler   string `yaml:"decompiler"`
}

YamlConfig represents Pitest's yml config data.

type YamlWrapper

type YamlWrapper struct {
	Cfg *YamlConfig `yaml:"pitest"`
}

YamlWrapper used to load the pitest configuration from the .marv.yml file.

func (*YamlWrapper) Init

func (y *YamlWrapper) Init() interface{}

func (*YamlWrapper) Load

func (y *YamlWrapper) Load(yml []byte) (bool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL