By Shivam Singh, founder of TesterRank · Updated September 2026
Maven enforces a standard directory layout. This isn't optional — it's a convention. If you put your files in the right folders, Maven finds them automatically. No configuration needed. This is what "convention over configuration" means.
Maven expects files in fixed places. Follow this layout and Maven finds your tests, test data and settings without any extra setup.
banking-portal-automation/
├── pom.xml # Project configuration
├── src/
│ ├── main/
│ │ └── java/ # Application/utility code
│ │ └── com/testerrank/
│ │ ├── utils/ # Utility classes (ExcelReader, ConfigReader)
│ │ └── constants/ # Constants (URLs, timeouts)
│ └── test/
│ ├── java/ # ALL test code goes here
│ │ └── com/testerrank/
│ │ ├── base/ # BaseTest class
│ │ ├── pages/ # Page Object classes
│ │ ├── tests/ # Test classes
│ │ └── listeners/ # TestNG listeners
│ └── resources/ # Config files, test data
│ ├── testng.xml # TestNG suite file
│ ├── testng-smoke.xml # Smoke test suite
│ ├── testng-regression.xml # Regression test suite
│ ├── config.properties # Browser, URL, credentials
│ └── testdata/ # Excel files, CSV, JSON
│ └── login-data.xlsx
└── target/ # Maven generates this — NEVER edit
├── classes/ # Compiled main code
├── test-classes/ # Compiled test code
├── surefire-reports/ # TestNG HTML reports
└── allure-results/ # Allure report data| Folder | What Goes Here | Examples |
|---|---|---|
| src/main/java | Utility classes, helpers, constants | ConfigReader.java, ExcelUtils.java |
| src/test/java | ALL test-related code | LoginTest.java, LoginPage.java, BaseTest.java |
| src/test/resources | Config files, test data, testng.xml | config.properties, testdata/users.xlsx |
| target/ | Maven-generated output (auto-created) | Compiled .class files, test reports |
The target/ folder is generated by Maven. Never edit files inside it — they get deleted every time you run mvn clean. Also, always add target/ to your .gitignore. Do not commit compiled files to Git.
A common debate in QA projects: should Page Objects go in src/main/java or src/test/java? In most QA automation projects, Page Objects go in src/test/java because they're part of the test framework, not a standalone application. Only put code in src/main/java if it's a genuine utility that could be reused across different projects.
Q: Explain the Maven project structure for a Selenium project.
A: A Maven Selenium project follows the standard Maven structure. pom.xml sits at the root with all dependencies and plugins. src/main/java holds utility classes like ConfigReader and ExcelUtils. src/test/java holds all test code — BaseTest, Page Objects, test classes, and listeners. src/test/resources holds configuration files like config.properties, testng.xml suite files, and test data (Excel, CSV). When Maven builds, it compiles everything into the target/ folder where you also find surefire-reports with test results.
In interviews, if they ask "where is your testng.xml?" — the answer is always src/test/resources. If they ask "where are your test classes?" — src/test/java. This shows you understand Maven conventions.
Key Point: Maven's convention: src/test/java for test code, src/test/resources for config/data, target/ for generated output. Follow it and Maven works automatically.