🧪 Unit Test
TestNG
1. Prerequisites
2. Create a Maven Project
mvn archetype:generate -DgroupId=com.example -DartifactId=testng-demo -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false3. Configure pom.xml
pom.xml<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>com.example</groupId>
<artifactId>testng-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- TestNG Dependency -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>4. Create a Class to Test
5. Write a TestNG Test
6. Run the Tests
Jest
1. Prerequisites
2. Initialize a Node.js Project
3. Install Jest
4. Configure package.json
package.json5. Create a Function to Test
6. Write a Jest Test
7. Run the Tests
Last updated