Test a service
Updated at:
Developers and testers often need to call online services to debug deployments or query data. The service testing feature lets you enter invocation parameters in the console, initiate a service call, and view the results.
Background information
- The service testing feature is in public preview and is free to use.
- If you use a RAM user to test services, you must first configure the required permissions for service testing in RAM. For more information, see Configure permissions for service testing in RAM.
Procedure
- Log on to the EDAS console. In the navigation pane on the left, choose .
- To the right of Service Test, select a microservices namespace, and then click a service name.
- In the Select Test Method pane, set the parameters, and then click Execute.
Parameter Description Invocation IP The IP address of the service instance (ECS or pod). If multiple instances are deployed, select one IP address from the list for the test. You can select only one. Test Method The target method to test. Parameter Type The parameter type of the target method. For Parameter Type, specify the package path. For example, set the String type to java.lang.String. EDAS automatically adds the package path for common Java types. For custom types, add the package path before you test the service. Test Parameters Set the parameter values based on the parameter type. You can set this using the Tree or Code view.
Verify the results
In the Result area, check if the test is successful. The test result can be one of the following:
- The test fails, and a message indicates that the test engine is preparing. The test engine requires 30 to 50 seconds to initialize. Wait for 30 to 50 seconds and then run the test again.
- The test fails and displays a failure response message from the service. Use the response message to troubleshoot problems with the service port, the network, or the code itself.
- The test is successful and displays the response from the service.
More examples
The overall format for test parameters is a JSON array. The following are examples of valid parameter inputs:
| Parameter type | Parameter example | Notes |
| (java.lang.String, int) | ["test", 100] | None. |
| (java.util.List, int) | [["hello", "world"], 100] | None. |
| (java.util.Map, java.lang.List) | [{"test": true}, ["hello", "world]] | None. |
| (java.util.Map, com.test.User) | [{"test": true}, {"id": 1, "name": "jack"}] | com.test.User is a custom type that contains the ID and Name properties. |
Is this page helpful?