Showing posts with label mvn test. Show all posts
Showing posts with label mvn test. Show all posts

Saturday, April 16, 2022

How to run tests in TestNg.xml using Maven

 Add the below code snippet inside pom.xml file

<build>
 <!-- Source directory configuration -->
       <sourceDirectory>src</sourceDirectory>
       <plugins>
           <!-- Following plugin executes the testng tests -->
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>2.19.1</version>
               <configuration>
       <!-- Suite testng xml file to consider for test execution -->
                   <suiteXmlFiles>
                       <suiteXmlFile>testng.xml</suiteXmlFile>
                   </suiteXmlFiles>
               </configuration>
           </plugin>
 <!-- Compiler plugin configures the java version to be used for compiling the code -->
           <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                   <source>1.8</source>
                   <target>1.8</target>
               </configuration>
           </plugin>
       </plugins>
 </build>

Now run from project root in command prompt or terminal

>mvn clean install

Read CSV from S3

 import csv def count_records(csv_file):     record_count = 0     first_line = None     last_line = None     # Open the CSV file and read it...