Wiki source code of Testing API Gateway

Last modified by Eva Torken on 2023/08/25 13:46

Show last authors
1 {{container}}{{container layoutStyle="columns"}}(((
2 In this microlearning, we will focus on testing your API Gateway (operations) with the help of two functionalities that the platform offers. First, we take a look at flow testing, secondly, we turn our attention to Swagger UI.
3
4 Should you have any questions, please contact [[academy@emagiz.com>>mailto:academy@emagiz.com]].
5
6 == 1. Prerequisites ==
7
8 * Basic knowledge of the eMagiz platform
9 * Basic knowledge of the API Gateway pattern
10
11 == 2. Key concepts ==
12
13 This microlearning centers around testing the API Gateway (operations).
14 With testing, we mean: Verifying that the operation does what it is supposed to do
15
16 * Flow testing is meant for testing the exit gates
17 * Swagger UI is meant for testing the whole operation as a client
18 * Both play an intricate part in testing your API Gateway
19
20 == 3. Testing API Gateway ==
21
22 In this microlearning, we will focus on testing your API Gateway (operations) with the help of two functionalities that the platform offers. First, we take a look at flow testing, secondly, we turn our attention to Swagger UI.
23
24 * Flow testing is meant for testing the exit gates
25 * Swagger UI is meant for testing the whole operation as a client
26 * Both play an intricate part in testing your API Gateway
27
28 === 3.1 Flow Testing ===
29
30 In the [[Crash Course Platform>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.WebHome||target="blank"]] we have several microlearnings on the topic of flow testing. Please take a look at those microlearnings first if the concept of flow testing is new to you. As described there, the flow testing functionality also works for API Gateway exit gates. There are two ways you can test your API calls to external systems, either with a mocked endpoint or live by calling the actual endpoint.
31
32 ==== 3.1.1 "Mock" Testing ====
33
34 Within the "mock" functionality, you can test the functional part of the API Gateway exit flow (i.e. transformation, authentication logic, filtering, and error handling) without testing the connectivity to the external system. This way you can increase the chances of being first time right before deploying your solution on the Test (or Acceptance) environment. A typical flow test for an exit gate looks as follows.
35
36 [[image:Main.Images.Microlearning.WebHome@intermediate-testing-emagiz-api-gateway-testing-the-api-gateway--flow-test-configuration.png]]
37
38 ==== 3.1.1 "Live" Testing ====
39
40 Live flow testing allows you to also test the connectivity part of the endpoint without having to deploy the flow first. This can be done by toggling from "mock" towards "live" below the exit gate component in the flowtest overview. With the right URL and credentials, you are able to retrieve the response from the endpoint and see inspect whether the functionality afterwards is working properly. The restriction of live flowtesting is that it can only be done with fuctioning endpoints and with the right credentials added to your flow.
41
42 === 3.2 Testing with Swagger UI ===
43
44 When you navigate to the Swagger UI page you will see that there is a try-it-out button per operation. After you have pressed this button you will see a button called Execute appear.
45 By pressing this button you will test the API Gateway functionality of a specific operation as if you were the client.
46
47 [[image:Main.Images.Microlearning.WebHome@intermediate-testing-emagiz-api-gateway-testing-the-api-gateway--swagger-ui-execute-try-it-out.png]]
48
49 The Swagger UI will give feedback based on what happened after you have pressed the button to execute
50
51 [[image:Main.Images.Microlearning.WebHome@intermediate-testing-emagiz-api-gateway-testing-the-api-gateway--feedback-inswagger-ui.png]]
52
53 == 4. Key takeaways ==
54
55 * Flow testing is meant for testing the exit gates
56 * Swagger UI is meant for testing the whole operation as a client
57 * Both play an intricate part in testing your API Gateway
58
59 == 5. Suggested Additional Readings ==
60
61 If you are interested in this topic and want more information on it please read the help text provided by eMagiz.
62
63 )))((({{toc/}}))){{/container}}{{/container}}