Skip to content

volodya-lombrozo/jtcop

Repository files navigation

jtcop

Maven Central License Hits-of-Code Lines of code codecov

This repository was inspired by various articles and discussion threads (such as these ones: "Unit test naming best practices" and "On The Layout of Tests"), and it consolidates knowledge on best practices for organizing and naming tests. The purpose of jtcop is to enhance the clarity and maintainability of your tests. In other words, jtcop is a static linter similar to tools like CheckStyle or PMD, but with a focus on test best practices.

You can read more about checks and rules in the docs.

How to use

The plugin could be run using several approaches but for both of them you need at least Maven 3.1.+ and Java 8+.

Invoke the plugin directly

In order to use the plugin with the latest version just invoke the next command in the root of your project:

mvn com.github.volodya-lombrozo:jtcop-maven-plugin:check

or short version:

mvn jtcop:check

After that you will see the result of the plugin execution in the console. If you want to use specific (older) version of the plugin, for example 0.1.16, just run the next maven command with specified version:

mvn com.github.volodya-lombrozo:jtcop-maven-plugin:0.1.16:check

or snapshot version:

mvn com.github.volodya-lombrozo:jtcop-maven-plugin:1.0-SNAPSHOT:check

Add the plugin to your pom.xml

The more convenient way to use the plugin is to add it to pom.xml file. In order to do that, just add the next snippet to the <plugins> section:

<plugin>
  <groupId>com.github.volodya-lombrozo</groupId>
  <artifactId>jtcop-maven-plugin</artifactId>
  <version>1.3.1</version>
  <executions>
    <execution>
      <goals>
        <goal>check</goal>
      </goals>
    </execution>
  </executions>
</plugin>

The default plugin phase is verify, so you don't need to specify it directly, but if you want to change it, just add the phase to execution section:

<execution>
  <phase>test</phase>
  <goals>
    <goal>check</goal>
  </goals>
</execution>

Skip the plugin execution

If you want to skip the plugin execution, just set the skip property to true in the configuration:

<configuration>
  <skip>true</skip>
</configuration>

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the main branch shortly, provided they don't violate our quality standards.