Configuring a project to use the GitLab connector

GitLab CI setup

In your gitlab-ci.yml add the path containing the build jar and the build-with-dependencies-jar (a jar containing dependencies, also known as a fat jar or an uber jar) to the GitlLab CI artifacts. For example:

package-job:
  script:
  - mvn package
  artifacts:
    paths:
    - target

Setup Diffblue config for your project

Add a diffblue.yml file to your project and specify the locations of the artifacts above. For example:

gitlabConnector:
  jobName: package-job
  build: 'target/[name].jar'
  dependenciesBuild: 'target/[name]-with-dependencies.jar'

You can also specify the suffix to add to test class names (e.g. 'Test' to generate a class called 'FooTest' that tests a class called 'Foo'), and the folder to save the tests to. For example:

gitlabConnector:
  jobName: package-job
  build: 'target/[name].jar'
  dependenciesBuild: 'target/[name]-with-dependencies.jar'
testSuffix: Test
testPath: src/test/java

(the above values are the defaults if you don't specify an alternative)

GitLab Project settings

  1. Ensure the GitLab user for the connector (e.g. diffblue-cover-bot) has permission to access the repository, including pushing and creating MRs.
  2. In the project's settings -> integrations screen, add a web hook with the following:
    • URL: http://[address]/gitlab-hook where [address] is the address of the GitLab connector.
    • Secret token: not currently used
    • Trigger: Select "Merge request events" and "Pipeline events"
  3. When a CI pipeline completes, if the connector can associate it with an open MR, it will trigger an analysis of the diff between the relevant branches.
  4. The system will begin analysis automatically

results matching ""

    No results matching ""