170
社区成员




Which course does this assignment belong to | 2401_Mu_SE_FZU |
---|---|
Where is the requirement for this assignment | Fifth Assignment——Alpha Sprint |
Team name | Smart Fishpond Access |
The goal of this assignment |
1. Claim Stress Test Method 2. Conduct API Test 3. Claim API test Results |
Other references | OpenAPI Specification (Swagger) |
Content
Interface Testing is a broader term that includes testing any communication between different software modules, systems, or applications, such as UI-to-backend interactions. In this report, our focus is solely on API testing. This means our testing approach is dedicated to verifying the proper operation and integration of APIs, ensuring that the data flow, response times, and security measures meet the required standards.
API testing is a critical process for testing application programming interfaces (APIs), aimed at validating the functionality, performance, security, and stability of the API. By simulating client requests to the API and checking if the responses meet the expected outcomes, API testing ensures that the API can correctly handle various types of data, maintain response times within acceptable limits*, and *manage exceptional cases effectively. API testing not only helps identify functional issues at the interface level but also verifies that the interaction between different modules within the system is functioning as expected. It is a key aspect of ensuring the stable operation of software systems. API testing guarantees smooth communication and collaboration across different layers and modules of the software system, assisting developers and testers in ensuring that the API meets the expected reliability, performance, and security standards.
Test interface | Methodologies | Testing time | Test content | Tester |
---|---|---|---|---|
Login | POST | November 28, 2024 23:01:32 | Log in | 832201306 |
Change | POST | November 28, 2024 23:01:34 | Forgotten password | 832201306 |
Register | POST | November 28, 2024 23:03:33 | Enrollment | 832201306 |
Verify | POST | November 28, 2024 23:03:37 | Verification code | 832201306 |
getDeviceLocation | GET | November 28, 2024 23:03:39 | Get device location | 832201306 |
getWord | GET | November 28, 2024 23:04:07 | Speech recognition | 832201306 |
getAnswer | GET | November 28, 2024 23:04:10 | Get a reply | 832201306 |
newDevice | POST | November 28, 2024 23:04:13 | Add new device | 832201306 |
data | GET | November 28, 2024 23:04:15 | Get data | 832201306 |
warnLog | GET | November 28, 2024 23:04:20 | Warning history | 832201306 |
push | POST | November 28, 2024 23:04:21 | Upload data | 832201306 |
Black box testing is used for this test. Black-box testing can ensure that the interface function meets the requirements and the response time is reasonable and stable by verifying the input and output of the interface. The advantage of black-box testing is that it simplifies the testing process, improves test coverage, and ensures that the interface operates normally in the actual environment while providing a basis for optimization of the interface. Because the interface to be tested for this test is known, and the code logic has been checked and optimized, this paper adopts the black-box test which mainly verifies the function.
Since the number of interfaces is small, this test uses Postman to manually test each interface and check its return value.
Caution
The newDevice and data interfaces are shown here as an example.
Step 1 Creating a new request
Open Postman and click “+” to create a new Request Tab.
Enter the URL of the interface in the Request Address field, for example: http://json.moyu-home.cn/newdevice
。
Select the request method (e.g. GET, POST) from the drop-down list on the left.
Step 2 Setting request parameters
Headers Settings
Click on the Headers tab. Add the necessary request header parameters: Content-Type: application/json
Body Settings
Click on the Body tab.
Add the request body:
{ "device": DZRY, "id": number }
Step 3 Send a request and validate the response
Click the "Send ” button to send the request.
Check return values and response times
Test result of data is shown below.
Fig. 1 "data" API test result
As shown in the Fig. 1 , the response time is 88ms, and the interface is able to respond and return data quickly, indicating that the interface is designed to have good performance and meet the expected functional requirements. In addition, the response time of 88ms adapts to common business requirements, and the system performance is good under the current load. Status code 200 indicates that the request was successfully processed and the interface returned the correct response without any errors.
This indicates that the interface is working properly and returns the correct data or response message as expected. The interface was able to respond quickly and returned status code 200, indicating that the interface functioned correctly and met the requirements specification. The request was successfully processed and no errors occurred in the returned data or execution results.
Test result of newDevice is shown below.
Fig. 2 "newDevice" API test result
As shown in the Fig. 2 , the response time is 159ms, the newDevice API works fine with a response time of 159ms and is able to process and return data within an acceptable time frame. The functional implementation of the interface has no exceptions and meets the design requirements. The response time of 159ms indicates that the interface has good processing power and can quickly complete the device registration task under normal load conditions.
The interface returns a status code of 200 OK, which indicates that the interface is not only working properly but also has good performance. The interface is able to complete the data processing and return the result in a very short time, which is suitable for efficient data interaction scenarios.