How to run/schedule a testng.xml from gitlab

Viewed 1336

I have placed a test automation suite in GitLab, I am able to run the test suite using testng.xml from eclipse.

I would like to set up a schedule a daily run from GitLab using CI/CD, please help/suggest me the steps to achieve continues testing from GitLab.

I tried by creating .gitlab-ci.yml file, but don't know the script to run the testng.xml file

Please help me if anybody tried this scenario

2 Answers

set the pom.xml of the project:

<properties>
  <testng> </testng>
</properties>

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>3.0.0-M3</version>
    <configuration>
      <suiteXmlFiles>                                                
        <suiteXmlFile>path_suite/${testng}.xml</suiteXmlFile>
      </suiteXmlFiles>
    </configuration>
</plugin>

you can define a environment variable in the gitlab ci to run your suite test

Related