Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99407

Test cases in TestNG are not executed by maven

$
0
0

I have the maven project with testng script as below:

package TestMaven;

import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

public class mavenTestDemo {

@Test
public void add() {
    System.out.println("Addintion");
    int a=10;
    int b=20;
    assertEquals(30, a+b);
}

@Test
public void sub() {
    System.out.println("Subtraction");
    int a=10;
    int b=20;
    assertEquals(10, b-a);
}

@Test
public void mult() {
    System.out.println("Multiplication");
    int a=10;
    int b=20;
    assertEquals(200, a*b);
}


}

Pom.xml as follows:

<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>MavenDemo</groupId>
  <artifactId>MavenDemo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>MavenDemo</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

 </properties>
  <dependencies>
     <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0</version>
            <scope>compile</scope>
        </dependency>


  </dependencies>
</project>

when i excute the code through maven i get following output: I directly executed from eclipse using "maven test" option and also tried from command line with the command "mvn clean install" For both the execution i am getting below result--->

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< MavenDemo:MavenDemo >-------------------------
[INFO] Building MavenDemo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenDemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Shilpa Khandge\eclipse-workspace\MavenDemo\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MavenDemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Shilpa Khandge\eclipse-workspace\MavenDemo\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MavenDemo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.900 s
[INFO] Finished at: 2020-01-09T14:33:56+05:30
[INFO] ------------------------------------------------------------------------

Viewing all articles
Browse latest Browse all 99407

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>