diff --git a/.github/workflows/maven-regression-test.yml b/.github/workflows/maven-regression-test-rest.yml similarity index 86% rename from .github/workflows/maven-regression-test.yml rename to .github/workflows/maven-regression-test-rest.yml index b36da6009..2909a8fb4 100644 --- a/.github/workflows/maven-regression-test.yml +++ b/.github/workflows/maven-regression-test-rest.yml @@ -1,4 +1,4 @@ -name: Maven Regression Test +name: Maven Regression Test (REST) on: push: @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - regression_test_ENG: + test_ENG: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -19,8 +19,8 @@ jobs: - run: mvn clean - run: mvn verify -P regression-testing-rest -D base.url=http://eng.elimu.ai - regression_test_TGL: - needs: regression_test_ENG + test_TGL: + needs: test_ENG runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -32,8 +32,8 @@ jobs: - run: mvn clean - run: mvn verify -P regression-testing-rest -D base.url=http://tgl.elimu.ai - regression_test_HIN: - needs: regression_test_TGL + test_HIN: + needs: test_TGL runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/maven-regression-test-ui.yml b/.github/workflows/maven-regression-test-ui.yml new file mode 100644 index 000000000..81e68e28e --- /dev/null +++ b/.github/workflows/maven-regression-test-ui.yml @@ -0,0 +1,46 @@ +name: Maven Regression Test (UI) + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + test_ENG: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + cache: maven + - run: mvn clean + - run: mvn verify -P regression-testing-ui -D headless=true -D base.url=http://eng.elimu.ai + + test_TGL: + needs: test_ENG + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + cache: maven + - run: mvn clean + - run: mvn verify -P regression-testing-ui -D headless=true -D base.url=http://tgl.elimu.ai + + test_HIN: + needs: test_TGL + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + cache: maven + - run: mvn clean + - run: mvn verify -P regression-testing-ui -D headless=true -D base.url=http://hin.elimu.ai diff --git a/INSTALL.md b/INSTALL.md index cf972ed3f..c8fd9f8eb 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -39,24 +39,7 @@ Next, to access the application in your browser, go to [http://localhost:8080/we ## Test π¨ -### Unit testing - -Run all tests: - - mvn clean test - -Run individual tests: - - mvn clean test -D test=WordDaoTest - -### Code coverage - -[![codecov](https://codecov.io/gh/elimu-ai/webapp/branch/main/graph/badge.svg?token=T1F9OTQVOH)](https://codecov.io/gh/elimu-ai/webapp) - -[![](https://codecov.io/gh/elimu-ai/webapp/branch/main/graphs/tree.svg?token=T1F9OTQVOH)](https://codecov.io/gh/elimu-ai/webapp) - - mvn test - open target/site/jacoco/index.html +See [`TEST.md`](./TEST.md) ## Test server diff --git a/TEST.md b/TEST.md new file mode 100644 index 000000000..b9b537ddd --- /dev/null +++ b/TEST.md @@ -0,0 +1,83 @@ +## Test Instructions + +### Unit testing βοΈ + +Run all tests: + + mvn clean test + +Run individual tests: + + mvn clean test -D test=WordDaoTest + +#### Code coverage π + +[![codecov](https://codecov.io/gh/elimu-ai/webapp/branch/main/graph/badge.svg?token=T1F9OTQVOH)](https://codecov.io/gh/elimu-ai/webapp) + +[![](https://codecov.io/gh/elimu-ai/webapp/branch/main/graphs/tree.svg?token=T1F9OTQVOH)](https://codecov.io/gh/elimu-ai/webapp) + + mvn test + open target/site/jacoco/index.html + +### Regression testing + +#### REST API + +First, launch the webapp on localhost: + + mvn jetty:run + +Then, in another terminal window run all the regression tests against the REST API: + + mvn verify -P regression-testing-rest + +> [!TIP] +> If you want to run the tests against another URL, set the `base.url` system property: +> +> mvn verify -P regression-testing-rest -D base.url=https://eng.elimu.ai + +#### UI + +First, launch the webapp on localhost: + + mvn jetty:run + +Then, in another terminal window run all the regression tests against the UI: + + mvn verify -P regression-testing-ui + +> [!TIP] +> If you want to run the tests against another URL, set the `base.url` system property: +> +> mvn verify -P regression-testing-ui -D base.url=https://eng.elimu.ai + +##### Headless πΆβπ«οΈ + +If you don't want the automated test software to open browser windows, you can disable that by setting the `headless` system property: + + mvn verify -P regression-testing-ui -D headless=true + +![](https://private-user-images.githubusercontent.com/1451036/361187317-35e99a19-f42d-4934-a0ba-f3d1e06ed6f6.png) + +--- + +
+ +
++ elimu.ai - Free open-source learning software for out-of-school children πβ¨ +
++ Website π + β’ + Wiki π + β’ + Projects π©π½βπ» + β’ + Milestones π― + β’ + Community ππ½ + β’ + Support π +
+ diff --git a/Test.md b/Test.md deleted file mode 100644 index bae8efb32..000000000 --- a/Test.md +++ /dev/null @@ -1,51 +0,0 @@ -# Regression Testing Guide - -This document outlines the regression testing process for our project using Maven profiles. - -## Available Profiles - -There are two Maven profiles set up for regression testing: - -1. `regression-testing-rest`: For REST API tests -2. `regression-testing-ui`: For UI tests using Selenium - -## Running Tests - -### REST API Tests - -To run the REST API regression tests, use the following command: -```bash -mvn clean verify -P regression-testing-rest -``` -This profile will: -- Skip the default test phase -- Run tests during the integration-test phase -- Include only test files matching the pattern `**/rest/**/*Test.java` - -### UI Tests - -To run the UI regression tests, use the following command: -```bash -mvn clean verify -P regression-testing-ui -``` -This profile will: -- Skip the default test phase -- Run tests during the integration-test phase -- Include only test files matching the pattern `**/selenium/**/*Test.java` - -## Configuration Details - -Both profiles use the Maven Surefire Plugin with the following key configurations: - -- Tests are skipped during the default test phase -- Tests are executed during the integration-test phase -- All tests are initially excluded, then specific patterns are included - -## Notes - -- Ensure that your test files are named appropriately and located in the correct directories to be picked up by the include patterns. -- The REST tests should be in directories containing "rest" in the path and end with "Test.java" -- The UI tests should be in directories containing "selenium" in the path and end with "Test.java" -- You may need to adjust your project structure or test naming conventions if tests are not being picked up as expected. - -For more detailed information about the Maven profiles and plugin configurations, refer to the `pom.xml` file in the project root. \ No newline at end of file diff --git a/pom.xml b/pom.xml index ea608bb85..4265a723f 100644 --- a/pom.xml +++ b/pom.xml @@ -575,8 +575,8 @@