0

Problem statement: Build run test case twice in Jenkins Build. working fine in the local environment Skills/Tools: Java, Maven, TestNG, Jenkins. I have tried removing testng.xml test classes. Don't have an idea of the reason.

pom:`?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.sample</groupId>
<artifactId>TESTPROJECT</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>

                        
                        <include>SAMPLE.java</include>

                    </includes>

                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>

        </plugin>

    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.14.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>

    </dependency>
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.6.1</version>
    </dependency>
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>4.0.6</version>
    </dependency>
</dependencies>

`

Logs

[INFO] --- maven-resources-plugin:2.6:resources (default-resources)
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/testproject/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) 
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 18 source files to /var/lib/jenkins/workspace/testproject/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) 
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) 

[INFO] Changes detected - recompiling the module! [INFO] Compiling 22 source files to /var/lib/jenkins/workspace/testproject/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test)

2 times recompiling test compile and default-testCompile

1
  • 1
    Probably we would need to see how are you configuring Jenkins. Can you share your Jenkinsfile? – João Farias Apr 8 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.