Since the server is a platform to provide a variety of services and client interaction data through the interface, so the server test work first need is the interface testing. Testers need to ensure that the interface functions to achieve the correct, then the other testers during system testing client and server bonding, will be able to exclude client issues because the server interface defects caused facilitate personnel positioning development issues through server interface functional test . The following is the server interface functional test platform for personal lessons learned:
First, the interface testing range
The test requirements of the server, the interface test range is divided into: 1, the new test interface; 2, test the new service function interface; 3, the entire server interface test. The desired successively increased test test interface, the test time under conditions sufficient, of course, need to be designed to test all interfaces, but if the test is short, should be a priority of the first test interface according to an exemplary operation of the user division, on the need for frequent call interface priority for testing.
Second, the interface testing strategy
Before conducting the test platform server interface, you first need to arrange a test server program interface, analysis point of interface testing, interface testing platform content server are:
Interface design review
Interfaces for data exchange server and the client, the client passes the data through the network protocol server interface to input data, and therefore should first constraint document data through the server and the client interface documentation check the validity of interactive data:
n is an integer type data bits
n precision floating-point data
n string data range values
It requires the client integer, float, string data and the maximum and minimum values which can be effective as an input interface server. The work can be carried out when the server design review, in order to ensure that no client data is automatically uploaded to operate truncation or rounding server.
Interface dependency checking
Above policy only comes to the test method of a single interface for the user, an action might cause the server to call multiple interfaces to complete, it is also necessary from the point of view of business processes, multiple interfaces to a variety of business operations involved dependence between calls for testing.
Interface dependency check value is mainly achieved by a further input value of the interface output interface, so the interface prior to testing, the test input values need to analyze the interface is obtained by the client to other interfaces or output, when designing test cases, adding the interface dependencies explanation for the test.
Interface input / output validation
Server interface function test is similar to the test unit, the test case in the design, the focus is on the interface module to verify the correctness of the input / output items, then the server interface processing according to the embodiment, various interfaces are classified:
The first category: condition judging Interface
Such interface after receiving the request data, will be determined according to the input parameter condition, and returns the appropriate result code, typically involves a conditional interfaces: a user interface to the authentication, the update status report, the password change / reset interfaces. Thus the input / output verifies emphasis focused on:
Verify 1) determination condition
To verify the determination conditions, it is necessary to know which interface is the entry to be determined according to Example password reset Interface:
Password Reset Interface
"Interface functions": Forgot your password operation launched after the user logs in, the user enter the mailbox information, Game Center will send a request to a server platform, server platform for users to randomly generate a new password sent to the user's mailbox.
"Interface direction": Game Center -> server platform
"Follow protocol": HTTPS, the request message using the Post manner
parameter name |
Parameter Type |
Parameter length |
Explanation |
userID |
Int |
10 |
User ID number |
|
String |
60 |
email address |
key |
String |
50 |
Interface name |
version |
String |
8 |
version number |
Response message (sendMessageRes)
parameter name |
Parameter Type |
Parameter length |
Explanation |
resultCode |
Int |
5 |
Return result code 42000 represents the successful return |
This correctness interface to judgment data (key is the name of the interface, if the server will not handle errors, version is the version number, which value is only used to record, not involved in determination) The userID, email input parameters, test interface design use case, should first determine the parameters of the interface is verified, these entries can not be empty, then use equivalence partitioning, boundary value to valid data according to the method userID, email variety of design entry, verification whether the interface can be processed .
Response 2) abnormal data
Only consider normal circumstances, regardless of the abnormal scene can not guarantee the normal operation of the interface function for password reset interface, the user ID does not exist, illegal, mail format input error, the user's mailbox information does not exist or is not activated is the need to consider the test abnormal scenario, the design of such input value, and checks the returned response code interfaces, to ensure the correct response code to the client to display the corresponding prompt information according to the abnormal situation. In short, the condition judgment interface strategy is at the discretion of the test conditions designed to test the value of various input interfaces.
The second category: Data Query Interface
After receiving the request data such interfaces, it first verifies the request is legitimate, then the request to query item database back to the client table data corresponding generally relates to data query interfaces are: User Profile / experience / event information query , to obtain the list of games, the number of online inquiries and other interfaces. Query interface to the user experience, for example:
User Experience query interface
"Interface function": After the user logs in Game Center, you can query the information they experience each game project, including the project's level of experience, grade title, experience value ceiling for today.
"Interface direction": Game Center -> server platform
"Follow protocol": HTTP + XML, the request message using the Post manner
parameter name |
Parameter Type |
Parameter length |
Explanation |
userID |
Int |
10 |
User ID number |
webkey |
String |
60 |
Currently assigned to the logged-on user specified key |
key |
String |
50 |
Interface name |
version |
String |
8 |
version number |
isAll |
Int |
1 |
Queries the user whether all the sports experience 0: Yes; No 1 |
sportItemID |
String |
50 |
Sports ID, when isAll = 1 can not be blank, specify the query experience a sports |
Response message (sendMessageRes)
parameter name |
Parameter Type |
Parameter length |
Explanation |
sportItemID |
String |
50 |
Sports ID |
sumExp |
Int |
11 |
The total value of the motion experience |
expLevel |
Int |
3 |
Experience Level |
minExp |
Int |
11 |
This minimum level experience |
expOrder |
Int |
11 |
Experience Ranking |
maxExp |
Int |
11 |
This maximum level experience |
todayExp |
Int |
11 |
Gain experience today |
todayExpLimit |
Int |
11 |
Experience cap today |
designation |
String |
30 |
Title (corresponding to the empirical value) |
winCount |
Int |
11 |
Victory screenings |
lossCount |
Int |
11 |
Failed screening |
isMaxExp |
Int |
1 |
Experience total value is maximized 0 No; 1 is |
This interface will first be judged according webkey request is legitimate, then queries the corresponding data in the data table in accordance with a request parameter userID, isAll, sportItemID. In addition to the interface as the same condition is determined based on the determination WebKey item, request parameter userID, isAll, sportItemID design lawful / legitimate and normal / abnormal test values, but also we need to verify the combined database query results:
1) whether the query according to the correct associated data table;
2) Verify whether the query results retrieved from the data table the correct entry in the table relates to the multi-joint inquiry, the same item in different tables test data of various design verification;
3) Modify the query results corresponding to data items in the data table, so that the range of values corresponding item null or minimum and maximum client to see if the correct output interfaces.
The third category: an interface logic operation
Such interfaces after receipt of the requested data, will conduct a series of logical operations, and then update the database based on the results of data processing, usually involving interface logic operations are: synchronous competition results, commodity payments, report a variety of data interfaces. Competition results to the synchronous interface as an example:
Synchronous Interface competition results
"Interface functions": the game server each time the user will race results passed to the server platform, the platform server updates the user based on the user's tournament rankings race results, and then stored in the database.
"Interface direction": the game server -> server platform
"Follow protocol": HTTPS + XML, the request message using the Post manner
parameter name |
Parameter Type |
Parameter length |
Explanation |
userID |
Int |
10 |
No user i-dong |
webKey |
String |
64 |
Currently assigned to the logged-on user specified key |
key |
String |
50 |
Interface name |
version |
String |
8 |
version number |
gymkanaCode |
String |
30 |
The game is currently involved in the Games, this parameter is null illustrate just ordinary users of the game |
sportItemID |
String |
50 |
Game item ID |
sportItemName |
String |
50 |
Project Name Game |
sportServerID |
String |
50 |
Game server IP |
matchSystem |
Int |
3 |
Racing to run competition system: 100 Rice: 1; 400 Rice: 2; 800 US: 4; 1500 US: 8; 4 × 100 US: 16; |
matchId |
String |
50 |
The unique id Coming Up |
record |
double |
|
当前用户成绩 (如record=8.123456)。非正常结束比赛时,即isWinner=3或4,如果是单人跑,isWinner=5,record=-1 |
unit |
String |
20 |
成绩单位 |
isWinner |
Int |
2 |
当前用户是否赢了0=输,1=赢,2=未完成,3=主动退出,4=被迫退出 |
competitorID |
Int |
10 |
对手idong号 |
competitorRecord |
double |
|
当前对手成绩,规则同record |
competitorIsWinner |
int |
2 |
对手输赢,规则同isWinner |
starttime |
String |
14 |
开始时间(yyyy-MM-dd HH:mm:ss) |
endtime |
String |
14 |
结束时间(yyyy-MM-dd HH:mm:ss) |
响应消息(sendMessageRes)
参数名称 |
参数类型 |
参数长度 |
说明 |
resultCode |
Int |
5 |
结果返回码,返回42000表示处理成功 |
score |
Int |
11 |
本次得分 |
preRank |
Int |
11 |
赛前积分在赛后的排名 |
rank |
Int |
11 |
积分排名 |
upRankFlag |
Int |
1 |
排名上升:1;排名不变:0;排名下降:-1 |
isUpLevel |
Int |
1 |
经验值是否升级 0 否;1 是 |
exp |
Int |
11 |
本次增加的经验值 |
expLevel |
Int |
3 |
经验值等级 |
designation |
String |
30 |
称号(对应于经验值) |
cPreRank |
Int |
11 |
对手赛前积分在赛后的排名 |
cRank |
Int |
11 |
对手赛后积分排名 |
cUpRankFlag |
Int |
1 |
对手排名上升:1;排名不变:0;排名下降:-1 |
encourageWord |
String |
15 |
鼓励语句 |
此接口比数据查询接口又更加复杂,除了用条件判断和数据查询类接口的策略对此接口进行测试用例设计之外,还需要验证对接口的算法规则进行检查,因为此接口涉及根据用户比赛成绩(record)进行排名然后返回其得分及排名情况(score、rank、upRankFlag、exp),通过对相关数据表中的数据进行查看方式,接口算法规则验证包括:
1)用户胜利、失败、中途主动/被动退出、规定时间内未完成比赛情况下,此场比赛得分(scroe)是否正确;
2) Users competition results than the last results takes time is short, long, flat case, the ranking (upRankFlag) is correct;
3) Users competition results in the first, last, time-consuming than the last results short / long / flat case, the user standings (rank) is correct;
4) User victory, defeat, half-way active / passive exit, the race is not completed within the prescribed time, and the user experience in a variety of experience levels range, empirical values are correct score calculated according to the formula.
Since the interface logic operations further relates to insert or update database operation, the database needs to be considered so Shihai characteristic test, the problem such as data accuracy, in a MySQL database, if the floating-point data, will be stored when the accuracy error (131,072.32 inserted float ( 10,2) type of data will become 131,072.31), and therefore the need for the amount of computation, statistics, scores comparable data, it is best to use fixed-point type.
The last test server interface if enough conditions would also need to do further testing of the interface code by white-box testing, by writing critical code test piles, can effectively find a character array as a result of reading a string using this type of cross-border BUG is not easy to find the black box through. The next job is how to perform server interface functional test by testing tools.