GitLab test reports - Files used in a test project not found despite maven dependency

Files used in a test project cannot be found despite the dependency in the pom.xml

Hi ! :wave:

  • My GitLab version : GitLab Community Edition [14.0.12]

I’m having some issues with the CI/CD of a test project. This test project (A) uses another project (B) on the same GitLab server.

I set up the CI/CD in order to obtain test reports in the pipelines, thanks to the maven-surefire plugin. It works fine, but the files (samples) which are used in the test cases are not found, so all the tests failed :

With the same error :

../path_to_the_sample_file (No such file or directory)

Locally in Eclipse IDE, JUnit tests pass, so the path to the files is correct, the files are indeed present where indicated.

The dependency between the project (B) where the files are and the test project (A) in which they are used is present in the pom.xml of the test project (A) :

    <dependency>
      <groupId>fr.company</groupId>
      <artifactId>my_project_B</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    </dependency>

I run the tests in the .gitlab-cy.yml file via maven:

ethernet-test:
  stage: build
  before_script:
    - sed "s|CI_PROJECT_DIR|${CI_PROJECT_DIR}|g" m2-settings.xml > ~/.m2/settings.xml
  script:
    - mvn verify -Dtest=Samples.Ethernet.AllEthernetTests -Dmaven.test.failure.ignore=true
  artifacts:
    paths:
      - target/surefire-reports/TEST-fr.test.Samples.Ethernet.AllEthernetTests.xml
    reports:
      junit:
        - target/surefire-reports/TEST-fr.test.Samples.Ethernet.AllEthernetTests.xml

How should I change the file path or the dependencies so that the files contained in project B are loaded correctly when running the tests in project A?

Thank you in advance for your help ! :blush: