Giter Club home page Giter Club logo

testng-gradle-example's Introduction

testng-gradle-example

A sample Gradle project to run TestNG tests with different command line args

Usage

Look into testsetup.gradle file custom tasks for more info.
  • a. Using gradle testExec custom task built on java exec plugin as a custom wrapper to TestNG cli options.
    ./gradlew clean testExec
    ./gradlew clean testExec -Pgroups=main # run tests from src/main/java folder
    ./gradlew clean testExec -Pgroups=test # run tests from src/test/java folder
    ./gradlew clean testExec -Pgroups=unit # run unit tests
    ./gradlew clean testExec -Pgroups=unit,int # run tests from multiple groups
    ./gradlew clean testExec -PdefaultListeners # run tests without custom listener setup
    ./gradlew clean testExec -Denv=test # run tests against specific test env
    ./gradlew clean testExec -Psuites=smoke.xml # run tests with specific xml
    ./gradlew clean testExec -Psuites=regression.xml,smoke.xml # run tests with multiple xml 
    ./gradlew clean testExec -Pthreads=5 # run parallel test methods with specified thread count
    ./gradlew clean testExec -Pthreads=3 -Pparallel=classes # run parallel test classes with set of threads 
    ./gradlew clean testExec -Denv=test -Pthreads=5 -Pgroups=main -Psuite=smoke.xml # run tests using multiple cli options
    
    # run a single specific test class
    ./gradlew clean testExec -Ptestclasses=com.features.demo.FeatureCTest
    
    # run multiple specific test classes
    ./gradlew clean testExec \
     -Ptestclasses=ccom.features.demo.FeatureCTest,com.features.demo.FeatureATest
    
    # run single test method
    ./gradlew clean testExec \
     -Ptestmethods=com.features.demo.FeatureCTest.testC1
    
    # run multiple test methods
    ./gradlew clean testExec \
    -Ptestmethods=com.features.demo.FeatureCTest.testC1,com.features.demo.FeatureATest.testA2
    
    # run tests from listed xml classes with only specified test groups
    ./gradlew clean testExec -Psuites=regression.xml -Pgroups=main
    
    # run tests from listed xml classes with only specified parallel tests collection with specified thread count
    ./gradlew clean testExec -Psuites=regression.xml -Pthreads=2 -Pparallel=tests   
    
  • b. Using testRun custom task built on gradle test plugin as a custom wrapper to run testNG tests
    ./gradlew clean testRun --tests com.features.demo.FeatureCTest
    
  • c. Using testGroups custom task built on gradle test plugin as a custom wrapper to run testNG groups based tests
    ./gradlew testGroups -Pgroups=main
    ./gradlew testGroups -Pgroups=main,unit,int
    

testng-gradle-example's People

Contributors

vamsidarbhamulla avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.