脑袋里装的浆糊咩?总是记不住,总是做不对。。。。要说你多少次???

存档:API测试疑惑

上一篇 / 下一篇  2010-07-19 19:24:06

API(Application Programming Interface)应用程序接口,应用编程接口
e.g.(摘自http://www.douban.com/service/apidoc/)豆瓣API是豆瓣为第三方开发人员提供的编程接口。利用豆瓣API,你可以在你的网站或程序中使用豆瓣的数据和功能(请务必遵守API使用条款)。
目前的豆瓣API支持的功能包括:
搜索并查看书籍、电影、音乐信息
搜索并查看用户信息,查看用户友邻信息
查看用户收藏
添加、更新、删除用户收藏
查看评论
发布、修改、删除评论
查看、添加、删除用户广播
查看、添加、删除用户日记
搜索并查看、添加、删除活动
查看、添加、删除、回复推荐
豆瓣 API 测试控制台http://modou.us/console

猫扑API测试控制台:


API测试除了要测试功能以外还要测试接口。一个API或者函数可以作为一个单元,对这个单元进行单元测试,你可以用黑盒方法,也可以用白盒方法。黑盒方法就是不去看这个单元的实现代码,只根据这个单元的功能说明来设计测试用例并进行测试。测试的时候你可能需要写一点简单的代码来调用这个函数,这就是所谓的驱动函数,你也可能需要写一些代码来接收或者验证被测单元的输出是否正确,这就是所谓的桩函数;白盒测试方法就是你通过分析被测单元的实现代码,根据不同的测试策略(如分支覆盖或者逻辑覆盖等)来设计测试用例并作相应的测试。
另外,API的测试中,接口的测试也很重要,自己写点测试代码,调用api。这些准备好,然后再考虑测试数据的覆盖。
xavier_007说:
接口测试我感觉自己写或者借助现有的工具都可以。
例如测试cpp的api
可以在win32上自己搭建环境,针对每个接口设计测试用例集,然后批量执行就可以了
也可以用工具,我用的是gtest,还好
正在尝试在wince上跑

API测试区别单元测试的英文原文存档

March 2006 - API Testing vs. Unit Testing: What's the difference?
With the emergence of extreme programming, test-driven development and other agile methods, unit testing has become an important part of almost every development effort. At the same time, many applications provide application programming interfaces (APIs) to allow code-level access to the functionality. These APIs, just like any other interface into the product, must be tested before they are released to the end-users. This article will examine the key similarities and differences between these two types of testing, focusing on the tools, the people involved in each, and the approaches taken to get the best results for your time and effort.

Since both API-testing and unit-testing target the code-level, we can use similar tools for both activities. The most commonly used unit-testing tools, such as the jUnit test framework (http://www.junit.org), can also be used to build your API testing harness.

In many organizations we've worked with, the unit testing and API testing activities are owned by different teams. Unit testing is almost always an activity that is owned by the development team; developers are expected to build unit tests for each of their code modules (these are typically classes, functions, stored procedures, or some other 'atomic' unit of code), and to ensure that each module passes its unit tests before the code is included in a build. This practice makes a lot of sense because it helps the developers solidify their code. Often times, this effort requires debugging and bug-fixing in real-time.

API testing, on the other hand, is typically an activity owned by the QA team, a staff other than the author of the code. API tests are often run after the build has been created, and it is common that the authors of the tests do not have access to the source code; they are essentially creating black box tests against an API rather than the traditional GUI.

Another key difference between API and unit testing lies in the test case design. Unit tests are typically designed by the developers to verify the functionality of each unit. The scope of unit testing often does not consider the system-level interactions of the various units; the developers simply verify that each unit in isolation performs as it should.

API testing, like other activities owned by the QA team, must consider the 'full' functionality of the system, as it will be used by the end user (in this case, another program). This means that API tests must be far more extensive than unit tests, and take into consideration the sorts of 'scenarios' that the API will be used for, which typically involve interactions between several different modules within the application.

So if your product contains an API that must be tested, how should you approach the task? First of all, recognize that API testing is a testing activity that happens to require some coding, and is usually beyond the scope of what developers should be expected to do. The testing team should own this activity. Secondly, recognize that traditional testing techniques such as equivalence classes and boundary analysis are also applicable to API testing, so even if you are not too comfortable with coding, you can still design good API tests. Finally, recognize that you will not be able to test all possible scenarios that are possible to use with your API. Focus your testing on the most likely usage scenarios, and also apply techniques such as Soap Opera Testing and forced error testing using various flavors of data type and size to increase your confidence in the test coverage.


TAG:

 

评分:0

我来说两句

日历

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

数据统计

  • 访问量: 29325
  • 日志数: 27
  • 图片数: 1
  • 书签数: 2
  • 建立时间: 2008-07-16
  • 更新时间: 2015-03-11

RSS订阅

Open Toolbar