wm apim test
This operation tests the projects deployed to API Gateway.
Syntax
wm apim test [options][projects]
projects. Specifies the projects in the local folder that have to be tested. You can provide multiple projects by providing comma separated project names as input.
The following table lists all available arguments for the wm apim test command and their descriptions.
Argument | Description |
---|---|
-l, --localDir localDirpath | Path of the local folder of the specified studio projects. This is a mandatory argument. |
-a, --all | Use --all to include all projects in the given local directory. If you do not want to build all projects in the given local directory, then specify the project name that is required. |
-t, --target target | Specify the endpoint of the API Gateway instance to which the asset has to be deployed. |
-n, --names | Specify the api kind in the format namespace:apiname:version. You can provide multiple asset names as comma separated entries as input. Studio supports only API assets. |
-u, --username username | Provide the username of the API Gateway instance to which the asset is deployed. This user must have Manage APIs functional privilege. This is a mandatory argument. |
-pwd, --password password | Provide the password of the API Gateway instance to which the asset is deployed. If you do not provide the password, CLI prompts for the password, where you can provide the masked password. |
-de, --deploy | Deploys the projects or the specified asset to webMethods API Gateway during testing. |
-e, --env key=value | Adds or overwrites the environment configuration values in the environment asset file. For example, key1=value1,key2=value2. |
-en, --endpoints | Tests the specified API, as defined by the --names parameter, against the
--endpoint value where it is already deployed. |
-d, --debug | Enables the debug mode. |
-h, --help | Displays help for the build command. |
1. Testing a single project
Syntax
wm apim test Projectname --localDir local_dir_path
Example
wm apim test Project1 --localDir /Users/user1/Desktop/apistudio_localdir
Tests the project, Project1, located in the local directory /Users/user1/Desktop/apistudio_localdir.
Outcome
As the tests start, it displays the asset added and a list of gateway endpoints of the APIs in the project. On successful execution of all tests you will see you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the Test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.
2. Testing multiple projects
Syntax
wm apim test Projectname1,Projectname2
--localDir local_dir_path
Example
wm apim test Project1,Project2 --localDir /Users/user1/Desktop/apistudio_localdir
Tests the projects, Project1 and Project2, located in the local directory /Users/user1/Desktop/apistudio_localdir.
Outcome
As the tests start, it displays the assets added and a list of gateway endpoints of the APIs in the project. On successful execution of all tests you will see you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the Test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.
3. Testing all projects
Syntax
wm apim test --all --localDir local_dir_path
Example
wm apim test --all --localDir /Users/user1/Desktop/apistudio_localdir
Tests all the projects located in the local directory /Users/user1/Desktop/apistudio_localdir.
Outcome
As the tests start, it displays the asset added and a list of gateway endpoints of the APIs in the project. On successful execution of all tests you will see you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the Test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.
4. Testing an API
Syntax
wm apim test Projectname --names namespace:name:version
--localDir local_dir_path
Example
wm apim test Project1 --names dev:TestPayments:1.0
--localDir /Users/user1/Desktop/apistudio_localdir
Tests an API specified by its name dev:TestPayments:1.0, located in the local directory /Users/user1/Desktop/apistudio_localdir.
Outcome
As the tests start, it displays the asset added and a list of gateway endpoint of the API. On successful execution of all tests you will see you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the Test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.
5. Testing a project by overwriting the environment configuration
Syntax
wm apim test Projectname --localDir local_dir_path
--env key=value
Example
wm apim test Project1 --localDir /Users/user1/Desktop/apistudio_localdir
--env Content-Type=application/json,petId=1
Tests a project, Project1, located in the local directory /Users/user1/Desktop/apistudio_localdir using the environment configuration values provided in the environment asset file.
Outcome
As the tests start, it displays the asset added and a list of gateway endpoints of the APIs in the project. On successful execution of all tests you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.
6. Testing a project using endpoints
Syntax
wm apim test Projectname --names namespace:name:version
--localDir local_dir_path --endpoints endpoint
Example
wm apim test Project1 --names dev:TestPayments:1.0 --localDir /Users/user1/Desktop/apistudio_localdir --endpoints http://host:port/gateway/ProductAPI10/1.0
Tests a project, Project1, located in the local directory
/Users/user1/Desktop/apistudio_localdir using the API endpoint
http://host:port/gateway/ProductAPI10/1.0
.
Outcome
As the tests start, the display shows the added assets. When all tests run successfully, the message Test executed successully... appears. Additionally, it shows the number of tests passed, the number failed, and the overall test status. You can view details for each test, including the resource, assertion, status, and, for any failed test, an error message explaining the reason for failure.
7. Deploying and testing a project
Syntax
wm apim test Projectname --localDir local_dir_path
--target "http://host:port"
--username username --password password --deploy
Example
wm apim test Project1 --localDir C:/Users/user1/Desktop/apistudio_localdir
--target "http://host:port"
--username "******" --password "******" --deploy
Deploys the project, Project1, located in the local directory /Users/user1/Desktop/apistudio_localdir to the specified API Gateway instance. On successful deployment it tests the deployed project.
Outcome
As the tests start, it displays the asset added and a list of gateway endpoints of the APIs in the project. On successful execution of all tests you will see you will see the message Test executed successully.... In addition, it displays the number of tests passed, number of tests failed and the Test status. You would also see the details of each test such as resource, assertion, status and in case of a failed test an appropriate message with the reason for failure.