Executing NUnit tests in gradle

To use NUnit in your Gradle project, you will have to use below dependency.
 
dependencies {
    testCompile group: 'org.testng', name: 'testng', version: '6.9.10'}
We can execute the NUnit tests in a Gradle project by issuing below command.

gradle test

By default, this command will execute all test classes that end with Test or Tests To use TestNG in your project, ensure that you have below configuration in build.gradle.

test {
    useTestNG {
        
    }
}

To execute tests from specific classes

test –tests=junit.SimpleSuite

To execute tests from all classes in specific package

test –tests=junit.*

To execute specific test method

test –tests=junit.SimpleSuite.test2

To execute tests from specific category

test{
    useTestNG  {
        excludeGroups 'sanityTests'
        includeGroups 'regressionTests'
    }
}

Web development and Automation testing

solutions delivered!!