Back to Skills

testng-fundamentals

verified

Use when working with TestNG annotations, assertions, test lifecycle, and configuration for Java testing.

View on GitHub

Marketplace

han

TheBushidoCollective/han

Plugin

jutsu-testng

Technique

Repository

TheBushidoCollective/han
60stars

jutsu/jutsu-testng/skills/testng-fundamentals/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-testng/skills/testng-fundamentals/SKILL.md -a claude-code --skill testng-fundamentals

Installation paths:

Claude
.claude/skills/testng-fundamentals/
Powered by add-skill CLI

Instructions

# TestNG Fundamentals

Master TestNG fundamentals including annotations, assertions, test lifecycle, and XML configuration for Java testing. This skill provides comprehensive coverage of essential concepts, patterns, and best practices for professional TestNG development.

## Overview

TestNG is a powerful testing framework for Java inspired by JUnit and NUnit, designed to cover a wider range of test categories: unit, functional, end-to-end, and integration testing. It supports annotations, data-driven testing, parameterization, and parallel execution.

## Installation and Setup

### Maven Configuration

Add TestNG to your Maven project:

```xml
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.9.0</version>
    <scope>test</scope>
</dependency>
```

Configure the Surefire plugin for TestNG:

```xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.2.5</version>
    <configuration>
        <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>
```

### Gradle Configuration

Add TestNG to your Gradle project:

```groovy
dependencies {
    testImplementation 'org.testng:testng:7.9.0'
}

test {
    useTestNG()
}
```

## Core Annotations

### Test Lifecycle Annotations

TestNG provides comprehensive lifecycle annotations:

```java
import org.testng.annotations.*;

public class LifecycleTest {

    @BeforeSuite
    public void beforeSuite() {
        // Runs once before the entire test suite
        System.out.println("Before Suite");
    }

    @AfterSuite
    public void afterSuite() {
        // Runs once after the entire test suite
        System.out.println("After Suite");
    }

    @BeforeTest
    public void beforeTest() {
        // Runs before each <test> tag in testng.xml
        System.out.println("Before Test");
    }

    @AfterTest
    public void afterTest() {
        

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
12022 chars