testing is a testing methodology where the objective is to test the application as a whole.
E2E tests in TEAMMATES are located in the package teammates.e2e and configured in src/e2e/resources/testng-e2e.xml.
Before running E2E tests against your local development environment, ensure you have completed the following:
Start both development servers
./gradlew serverRun (runs on http://localhost:8080)npm run start (runs on http://localhost:4200)Configure test.properties
src/e2e/resources/test.properties to specify:
test.selenium.browser)Download the appropriate browser driver
Important:
If you run the frontend and backend separately (which is the standard setup for development), update your URLs intest.properties:test.app.frontendurl=http://localhost:4200 test.app.backendurl=http://localhost:8080
TEAMMATES E2E testing requires Firefox, Chrome, or Edge (Chromium-based).
Before running tests, modify src/e2e/resources/test.properties as needed — for example, to configure which browser and test accounts to use.
E2E tests follow this configuration:
| Test suite | Command | Results can be viewed in |
|---|---|---|
| E2E tests | ./gradlew e2eTests | {project folder}/build/reports/e2e-test-try-{n}/index.html, where {n} is the test run number |
| Any individual E2E test | ./gradlew e2eTestTry1 --tests TestClassName | {project folder}/build/reports/e2e-test-try-1/index.html |
E2ETryTest1 to E2ETryTest5 correspond to the initial and subsequent retry attempts for failed tests. The SQL version of E2E tests can be run with: ./gradlew e2eTestsSql.
Before running E2E tests, make sure both frontend and backend servers are running locally.
Some test cases may fail intermittently due to timing issues — rerun them until they pass.
If you are testing against a production server (staging server or live server), some additional tasks need to be done.
src/e2e/resources/test.properties as instructed in its comments.
Gmail API as follows:
src/e2e/resources/gmail-api (create the gmail-api folder) of your project and rename it to client_secret.json.EmailAccountTest to confirm that the setup works. For the first run, it is expected that you will need to grant access from the test Gmail account to the above API.As E2E tests should be written from the end user perspective, each test case should reflect some user workflow.
In TEAMMATES, E2E test cases are organized by page. For each page, we:
Selenium is used to locate and interact with elements in the UI.
All E2E test classes inherit from BaseE2ETestCase which contains methods that are common to most test cases, such as preparing the Browser object used for testing.
To help verify the state of the database, BackDoor contains methods to create API calls to the back-end without going through the UI.
To make E2E tests resilient to UI changes, TEAMMATES adopts the Page Object Pattern.
Each page in TEAMMATES is represented by a page object class. The page object class abstracts interactions with UI elements and only exposes the functionality of each page as methods.
To maximise the effectiveness of Page Object Pattern, interaction with UI elements should not occur outside the page objects.
The page object should have methods to represent the main functionality of the page that testers can use to simulate user actions.
fillSearchBox and clickSearchButton, it is better to have a method searchForInstructor which hides the UI elements used.All Page Object classes inherit from AppPage which contains methods that are common for interacting with the web elements such as filling in textboxes.
Why are all the tests done in one testAll() method?
We bundle together everything as one test case instead of having multiple test cases. The advantage is that the time for the whole test class will be reduced because we minimize repetitive per-method setup/teardown. The downside is that it increases the time spent on re-running failed tests as the whole class has to be re-run. We opt for this approach because we expect tests to pass more frequently than to fail.
Why is there one JSON file per test case?
Each test case has its own JSON file and the data inside has a unique prefix to prevent clashes in the database that may cause test failure, since tests are run concurrently.
If you encounter issues, refer to the E2E Troubleshooting Guide, which covers:
If issues persist, open a discussion thread and include:
test.properties snippets (without credentials)