Swift edition
Troubleshooting
When a run stops, it says why in one sentence, where it looked, and the command to run next, on stderr, with exit code 2 (3 when the tests themselves fail). This page is the cases you’re most likely to meet first, and what to do about each.
No Swift project there
Section titled “No Swift project there”mutastic runs on the directory it’s given, or the one it’s run in, and that directory, or one
above it, needs a Package.swift, an .xcodeproj or an .xcworkspace. From inside a package,
mutastic run Sources/Pricing runs the package, as swift build would build it:
mutastic run nowheremutastic: there's no project in nowhere for mutastic to test.It looked in /home/you/project/nowhere and every directory above it, for a Package.swift, an .xcodeproj or an .xcworkspace.Go to your project, or name its directory: mutastic run <project directory>Name the package’s directory, the one with its Package.swift, or cd into it.
A mistyped command
Section titled “A mistyped command”A word that’s nearly a command gets the command it was close to:
mutastic verfiy m86f9a31d samples/pricingmutastic: mutastic has no command verfiy. There's one called verify. mutastic verify m86f9a31d samples/pricingThe tests fail without any mutant
Section titled “The tests fail without any mutant”Before any mutant runs, every test runs with no mutant in. A test that fails there would seem to catch every mutant it reaches, so the run stops and names it. Here a test that expects free shipping below the threshold was added to the pricing sample:
@Test func shippingIsFreeAtFortyNine() { #expect(Pricing().shipping(total: 49) == 0)}mutastic run samples/pricingmutastic: PricingTests.shippingIsFreeAtFortyNine() fails without any mutant, so mutastic can't judge one.It failed: Expectation failed: (Pricing().shipping(total: 49) → 5) == 0To run without it until it's fixed, list it under exclude-tests: in mutastic.yaml with a reason, or for this run add --exclude-tests='PricingTests.shippingIsFreeAtFortyNine()'Its output is in samples/pricing/.build/mutastic/tests.log. To run it alone: swift test --package-path samples/pricing --filter 'PricingTests\.shippingIsFreeAtFortyNine\(\)'The run exits with 3. Fix the test, or the code, until swift test passes; the tests’ own output
is in .build/mutastic/tests.log. A test that can’t pass here, one that needs a server or a fixed
port, can be left out of every run with exclude-tests: in mutastic.yaml, or of one run with
--exclude-tests (see Running on your project).
A mutant that doesn’t compile
Section titled “A mutant that doesn’t compile”Some changes don’t compile in every place they’re made: a + on two strings has no -, say.
mutastic finds the mutant the compiler’s error is in, withdraws it, and builds again; the progress
line says how many were withdrawn, and the summary’s Build line how many rounds it took. A
withdrawn mutant isn’t counted, for or against your tests. See
How the tests are run.
A run that takes long
Section titled “A run that takes long”Most of a run’s time is the build, the coverage pass and the mutants’ tests. To spend less:
--since=mainruns only the mutants on lines changed sincemain, and--atthe ones on the lines you name.--shard=1/4runs one share of the mutants, for splitting a run across CI jobs, and--from-shardsputs the shares back together.--exclude-testsleaves out a slow test that can’t catch anything.
An Xcode project takes longer than a package: see Xcode projects.
Xcode projects
Section titled “Xcode projects”A project with several schemes, an Xcode that’s older than the one that saved the project, or tests for a platform mutastic doesn’t run on each stop with their own code: Xcode projects has them.