MCPcopy Index your code
hub / github.com/dodie/scott

github.com/dodie/scott @4.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 4.0.1 ↗ · + Follow
706 symbols 1,908 edges 110 files 36 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

License Maven Central Build Status Quality Gate Status

Scott Test Reporter for Maven and Gradle

Get extremely detailed failure messages for your tests without assertion libraries, additional configuration or changes on existing tests.

Scott in Action

As you can see, besides the usual assertion error, Scott reports the state changes and assignments in the test cases, nicely visualized on the source code of the test method.

Works well with other testing tools and frameworks, for example: - JUnit 5 - JUnit 4 - Cucumber Java - Mockito

Supports Java 7+ (up to Java 17).

How to use

Just drop it into your project, and Scott will automatically enhance your test reports. You don't have to use its API or modify your existing tests to make it work.

Scott: All systems automated and ready. A chimpanzee and two trainees could run her.

Kirk: Thank you, Mr. Scott. I'll try not to take that personally.

Gradle

Add hu.advanceweb.scott-gradle-plugin to your build.gradle:

plugins {
  id "hu.advanceweb.scott-gradle-plugin" version "4.0.1"
}

Example projects: - JUnit 4 - JUnit 5

Maven

Add the following to your pom.xml:

<build>
    <plugins>

        <plugin>
            <groupId>hu.advancedweb</groupId>
            <artifactId>scott-maven-plugin</artifactId>
            <version>4.0.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>

    <dependency>
        <groupId>hu.advancedweb</groupId>
        <artifactId>scott</artifactId>
        <version>4.0.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

The scott-maven-plugin automatically configures maven-surefire-plugin and maven-failsafe-plugin to use Scott via the argLine project property. If you wish to further customize the argLine property for these plugins, you have to pass the managed argLine as well to ensure Scott works properly. For an example, check the following snippet that configures the surefire plugin to enable preview language features for Java:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <argLine>${argLine} --enable-preview</argLine>
    </configuration>
</plugin>

Example projects: - JUnit 4 - JUnit 5

Cucumber

Scott for Cucumber tracks whole scenarios, and in case of a failure it prints the details of every step involved.

This feature provides valuable information if a test fails in a CI environment, as it can make it much easier to reproduce and fix browser-based tests, especially for flaky tests.

HTML

For more info, check the example project using io.cucumber:cucumber-java.

Wire it up manually

If you can't use the Gradle or Maven Plugin for some reason, you can do the necessary steps manually.

Configuration

In case you are not satisfied with the default tracking behavior, the Scott Maven Plugin and Gradle Plugin provides configuration options to fine-tune its behaviour.

Using Scott as an instrumentation library

Scott's instrumentation module can be invoked programmatically with fine-tuned instrumentation rules so you can build your own solution on top of Scott. For more information, check the user guide.

Changelog

See Releases.

Highlights from the latest releases:

Contributing

Contributions are welcome! Please make sure to visit the contribution and development guide for some important notes on how to build and debug Scott. If you are looking for issues that can get you started with the development, see Issues marked with the help-wanted tag.

Extension points exported contracts — how you extend this code

Function2 (Interface)
(no doc) [2 implementers]
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/LambdaRecordingTest.java
TestScottRuntimeVerifier (Interface)
(no doc) [2 implementers]
scott-tests/configuration-based-tests/src/test/java/hu/advancedweb/scott/helper/TestScottRuntimeVerifier.java
InterfaceTestHelper (Interface)
(no doc)
scott-tests/junit5-tests/src/test/java/hu/advancedweb/scott/InterfaceTestHelper.java
Operation (Interface)
(no doc)
scott-examples/cucumber-io-cucumber/src/main/java/hu/advancedweb/example/Operation.java
StaticFieldRecordingTestHelperInterface (Interface)
(no doc) [1 implementers]
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/StaticFieldRecordingTestHelperInterface.java
ExceptionToleratingSupplier (Interface)
(no doc)
scott-tests/configuration-based-tests/src/test/java/hu/advancedweb/scott/helper/TestScottRuntime.java

Core symbols most depended-on inside this repo

add
called by 51
scott-examples/junit4/src/main/java/hu/advancedweb/example/FaultyAdder.java
get
called by 41
scott-examples/junit4/src/main/java/hu/advancedweb/example/Counter.java
bar
called by 40
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/MockitoTest.java
build
called by 37
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/config/Configuration.java
trackMethodStart
called by 34
scott-tests/configuration-based-tests/src/test/java/hu/advancedweb/scott/helper/TestScottRuntimeVerifier.java
setTrackerClass
called by 33
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/config/Configuration.java
toString
called by 31
scott/src/main/java/hu/advancedweb/scott/runtime/track/StateData.java
equals
called by 25
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/AccessedField.java

Shape

Method 571
Class 125
Interface 7
Enum 3

Languages

Java100%

Modules by API surface

scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/config/Configuration.java40 symbols
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/StateTrackingMethodVisitor.java31 symbols
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java30 symbols
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/param/InstrumentationActions.java25 symbols
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/VariableRecordingTest.java25 symbols
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/RecordMutationTest.java22 symbols
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/MockitoTest.java21 symbols
scott/src/main/java/hu/advancedweb/scott/runtime/track/StateRegistry.java19 symbols
scott/src/main/java/hu/advancedweb/scott/runtime/ScottCucumberIoFormatter.java16 symbols
scott/src/main/java/hu/advancedweb/scott/runtime/report/ScottReport.java15 symbols
scott/src/main/java/hu/advancedweb/scott/runtime/report/FailureRenderer.java14 symbols
scott-tests/junit4-tests/src/test/java/hu/advancedweb/scott/StaticFieldRecordingTest.java13 symbols

For agents

$ claude mcp add scott \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact