Before writing a single line of code, set up the folder structure. A clean structure is half the battle. When a new person opens your project, they should know where everything is in 10 seconds.
api-test-framework/
├── pom.xml
├── testng.xml
├── src/
│ └── test/
│ ├── java/
│ │ └── com/company/api/
│ │ ├── config/
│ │ │ └── ConfigReader.java
│ │ ├── base/
│ │ │ ├── BaseTest.java
│ │ │ └── BaseEndpoint.java
│ │ ├── pojo/
│ │ │ ├── request/
│ │ │ │ ├── CreateUserRequest.java
│ │ │ │ └── CreateAccountRequest.java
│ │ │ └── response/
│ │ │ ├── UserResponse.java
│ │ │ └── AccountResponse.java
│ │ ├── endpoints/
│ │ │ ├── UserEndpoint.java
│ │ │ └── AccountEndpoint.java
│ │ ├── tests/
│ │ │ ├── UserTests.java
│ │ │ └── AccountTests.java
│ │ └── utils/
│ │ └── TestDataGenerator.java
│ └── resources/
│ ├── config/
│ │ ├── dev.properties
│ │ ├── staging.properties
│ │ └── prod.properties
│ ├── schemas/
│ │ ├── user-schema.json
│ │ └── account-schema.json
│ └── testdata/
│ ├── users.csv
│ └── accounts.json<?xml version="1.0" encoding="UTF-8"?>
<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.company</groupId>
<artifactId>api-test-framework</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<rest-assured.version>5.4.0</rest-assured.version>
<testng.version>7.9.0</testng.version>
<jackson.version>2.17.0</jackson.version>
<allure.version>2.25.0</allure.version>
</properties>
<dependencies>
<!-- REST Assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<!-- JSON Schema Validator -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<!-- Jackson for POJO serialization -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- Allure TestNG -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
<!-- Allure REST Assured -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-rest-assured</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<env>${env}</env>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>Keep version numbers in <properties>. When you upgrade REST Assured from 5.4.0 to 5.5.0, you change one line. Not six. This is the same principle as the framework itself — single source of truth.
Everything goes under src/test/ — not src/main/. This is a test project. There is no production code here. If you put classes in src/main/java, Maven will compile them differently and your classpath will get messy.
Q: Walk me through the folder structure of your API test framework.
A: We use a standard Maven layout. Everything is under src/test/. The config package has ConfigReader which loads environment-specific properties from src/test/resources/config/. The base package has BaseTest (common RequestSpec setup) and BaseEndpoint (shared endpoint logic). The pojo package is split into request and response sub-packages for Jackson models. The endpoints package has one class per API resource — UserEndpoint, AccountEndpoint. The tests package has TestNG test classes. Resources has config files, JSON schemas, and test data files. The pom.xml manages REST Assured, TestNG, Jackson, and Allure dependencies with version properties.
Key Point: Use standard Maven layout with everything under src/test/. Separate packages for config, base, pojo, endpoints, tests, and utils. Keep version numbers in pom.xml properties.