The Pre Registration API Test Rig is designed for the execution of module-wise automation API tests for the pre-registration services. This test rig utilizes Java REST Assured and TestNG frameworks to automate testing of the pre-registration API functionalities. The key focus is to validate the pre-registration creation, appointment booking and related functionalities provided by the pre-registration module.
- Smoke: Contains only positive test scenarios for quick verification.
- Regression: Includes all test scenarios, covering both positive and negative cases.
This test rig covers only external API endpoints exposed by the pre registration services module.
Before running the automation tests, ensure the following software is installed on the machine:
- Java 21 (or a compatible version)
- Maven 3.9.6 (or higher)
- Lombok (Refer to Lombok Project)
- setting.xml (download here)
- apitest-commons library should be cloned and the JAR should be built. Refer to (README)
- Git Bash 2.18.0 or higher
- Ensure the
settings.xml
file is present in the.m2
folder.
- The
settings.xml
file should be present in two places:- In the regular Maven configuration folder (
/conf
) - Under
/usr/local/maven/conf/
- In the regular Maven configuration folder (
You can access the test automation code using either of the following methods:
- Clone or download the repository as a zip file from GitHub.
- Unzip the contents to your local machine.
- Open a terminal (Linux) or command prompt (Windows) and continue with the following steps.
- Copy the Git repository URL:
https://github.com/mosip/pre-registration
- Open Git Bash on your local machine.
- Run the following command to clone the repository:
git clone https://github.com/mosip/pre-registration
Once the repository is cloned or downloaded, follow these steps to build and install the test automation code:
-
Navigate to the project directory:
cd api-test
-
Build the project using Maven:
mvn clean install -Dgpg.skip=true -Dmaven.gitcommitid.skip=true
This will download the required dependencies and prepare the test suite for execution.
You can execute the test automation code using either of the following methods:
To execute the tests using Jar, use the following steps:
-
Navigate to the
target
directory where the JAR file is generated:cd target/
-
Run the automation test suite JAR file:
java -jar -Dmodules=prereg -Denv.user=api-internal.<env_name> -Denv.endpoint=<base_env> -Denv.testLevel=smokeAndRegression -jar apitest-prereg-1.3.0-SNAPSHOT-jar-with-dependencies.jar
To execute the tests using Eclipse IDE, use the following steps:
- Download and install the latest version of Eclipse IDE from the Eclipse Downloads.
After Eclipse is installed, follow these steps to import the Maven project:
- Open Eclipse IDE.
- Go to
File
>Import
. - In the Import wizard, select
Maven
>Existing Maven Projects
, then click Next. - Browse to the location where the
api-test
folder is saved (either from the cloned Git repository or downloaded zip). - Select the folder, and Eclipse will automatically detect the Maven project. Click Finish to import the project.
- Right-click on the project in the Project Explorer and select
Maven
>Update Project
. - This will download the required dependencies as defined in the
pom.xml
and ensure everything is correctly set up.
To execute the test automation suite, you need to configure the run parameters in Eclipse:
- Go to
Run
>Run Configurations
. - In the Run Configurations window, create a new configuration for your tests:
- Right-click on Java Application and select New.
- In the Main tab, select the project by browsing the location where the
api-test
folder is saved, and select the Main class asio.mosip.testrig.apirig.prereg.testrunner.MosipTestRunner
.
- In the Arguments tab, add the necessary VM arguments:
- VM Arguments:
-Dmodules=prereg -Denv.user=api-internal.<env_name> -Denv.endpoint=<base_env> -Denv.testLevel=smokeAndRegression```
- VM Arguments:
- Once the configuration is set up, click Run to execute the test suite.
- The tests will run, and the results will be shown in the Console tab of Eclipse.
Note: You can also run in Debug Mode to troubleshoot issues by setting breakpoints in your code and choosing Debug
instead of Run
.
- After the tests are executed, you can view the detailed results in the
api-test\testng-report
directory.
- env.user: Replace
<env_name>
with the appropriate environment name (e.g.,dev
,qa
, etc.). - env.endpoint: The environment where the application under test is deployed. Replace
<base_env>
with the correct base URL for the environment (e.g.,https://api-internal.<env_name>.mosip.net
). - env.testLevel: Set this to
smoke
to run only smoke test cases, orsmokeAndRegression
to run both smoke and regression tests. - jar: Specify the name of the JAR file to execute. The version will change according to the development code version. For example, the current version may look like
apitest-prereg-1.3.0-SNAPSHOT-jar-with-dependencies.jar
.
To run the tests for both Smoke and Regression:
- Ensure the correct environment and test level parameters are set.
- Execute the tests as shown in the command above to validate Pre registration services API functionalities.
This project is licensed under the terms of the Mozilla Public License 2.0