51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 10879|回复: 18
打印 上一主题 下一主题

[资料] API testing VS Unit testing

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2007-7-30 14:06:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
最近在做API测试和单元测试,看到一片关于API测试和单元测试的文章,英文版的,但是写的还是很清楚的,本人翻译了一下,提供给大家。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2008-11-27 15:48:38 | 只看该作者

just see

I want to see it, but I have not score
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-3-16 11:50:57 | 只看该作者

Thank you

It sound good
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2009-3-16 18:46:27 | 只看该作者
谢谢分享
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2009-3-24 16:05:54 | 只看该作者
also i'm focusing on API testing right now.

Thanks for sharing.
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2009-3-25 17:44:41 | 只看该作者
下来看看
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2009-6-10 22:51:19 | 只看该作者
谢谢
回复 支持 反对

使用道具 举报

该用户从未签到

8#
发表于 2009-8-18 10:13:01 | 只看该作者
这玩意还要分...
回复 支持 反对

使用道具 举报

该用户从未签到

9#
发表于 2010-3-15 09:48:29 | 只看该作者
这点破东西还要钱,
回复 支持 反对

使用道具 举报

该用户从未签到

10#
发表于 2010-4-26 16:55:06 | 只看该作者
kan bu dao a
回复 支持 反对

使用道具 举报

该用户从未签到

11#
发表于 2010-5-11 10:34:56 | 只看该作者
内容太短了
回复 支持 反对

使用道具 举报

该用户从未签到

12#
发表于 2010-7-16 11:37:28 | 只看该作者
LZ可否发原文网址???
回复 支持 反对

使用道具 举报

该用户从未签到

13#
发表于 2010-7-16 11:40:28 | 只看该作者
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.
回复 支持 反对

使用道具 举报

该用户从未签到

14#
发表于 2010-8-24 10:39:22 | 只看该作者
新人报道,大家多多关照
谢谢啦 呵呵
回复 支持 反对

使用道具 举报

该用户从未签到

15#
发表于 2010-11-1 16:31:57 | 只看该作者
非常好!  很有用! 虽然内容少,但很清楚。
回复 支持 反对

使用道具 举报

该用户从未签到

16#
发表于 2012-4-18 11:06:27 | 只看该作者
下了看看
回复 支持 反对

使用道具 举报

该用户从未签到

17#
发表于 2012-6-27 17:35:45 | 只看该作者
下了围观
回复 支持 反对

使用道具 举报

该用户从未签到

18#
发表于 2012-7-19 15:00:27 | 只看该作者
OMG, it is way too much expensive with such limited information.
回复 支持 反对

使用道具 举报

  • TA的每日心情
    开心
    2014-12-15 17:37
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]测试小兵

    19#
    发表于 2014-5-7 16:53:42 | 只看该作者
    谢谢lz
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-14 23:58 , Processed in 0.087049 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表