API test

上一篇 / 下一篇  2013-02-20 15:07:06 / 个人分类:API测试

As a test engineer, do you have any query about API testing? When you are assigned a task what test the API. Do you know what is API test, and do you want to know how to do API test. In this doc, I introduce principle of the API testing. I also show how to test API step by step (HTML API test as demo). If you have any question or any good suggestion when you go through this doc. Please let me know, I can update and enhance the content. I will appreciate that.

Part I. Principle of the API testing

Don’t think API testing belongs to unit test and it is developer’s business. In a project, the API doc (Interface doc) is produced in design stage. It is reference that the developers use it tocollaborative workand write the code. At the same time, the tester refers it to design the API test case.

What’s API?

API is abbreviation of Application Programming Interface. Is a set of routines,protocols, and tools for building software applications? A good API makes it easier to develop a program by providing all the building blocks. Aprogrammerthen puts the blocks together. This is the official explanation.

Actually it is agreement, if something/somebody has thisagreement. They can work well together. And make everything is very easy. A very simple example, the socket and plug, the socket is made by one factory; the plug is made by another factory. If we want all plug can match all socket. The factory of plug and factory of socket must comply with sameagreement. We named this agreement as API. It may be published by public organization, or official.

What’s API’s purpose?

In program development process, the API is the interface, theabstractclassor other lib file. It can use tocollaborative work. For example, define “File interface” like below, use to operate the file in project.

 

public interface File
{
  private string Filename;
  private int Filesize;
  private Boolean Readonly;
 
  public void read();
  public void write(File file);
  public void readLine();
  public void writeLine(File file);
}

In the develop team, refer to this interface, one person writes program what can invoke file operate file. Another person implements the function. They cansimultaneousdevelopment.

 

After completed an application orprogrammingmodule, the API should be publish at same time. Other people use this API to invoke application orprogrammingmodule. Or use to do incremental development.

 

Part II. How to test the API

I will describe this part by a previous project. Everybody uses HTML/DOM everywhere. But do you know the HTML/DOM has its API. The browser developers refer it to developer the browser (like IE, fireFox, Chome, and so on). The webpage developers refer it to design the web application. Next I will explain how to test the API of HTML/DOM. The API of HTML/DOM was published by W3C organization. Acommunityorganizationpublished all standard about web.

Eg: DOM3

http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html

in this specification I selected one of interface and test it


TAG: API api 测试

 

评分:0

我来说两句

日历

« 2024-03-27  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 5349
  • 日志数: 7
  • 建立时间: 2013-02-20
  • 更新时间: 2013-03-05

RSS订阅

Open Toolbar