- 浏览: 416369 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (255)
- Android (53)
- java (57)
- javascript (7)
- linux (19)
- springside3 (6)
- spring (2)
- struts2 (11)
- hibernate (2)
- jsp&servlet (15)
- jquery (1)
- ExtJs (5)
- freemarker (1)
- apache (5)
- mysql (3)
- tomcat (3)
- eclipse&maven (23)
- 电脑小技巧 (1)
- 配置安装 (3)
- 开源框架 (2)
- 设计模式 (2)
- 架构 (2)
- ajax (1)
- 正则表达式 (7)
- 测试 (2)
- 装修 (1)
- 不错的软件 (4)
- http协议 (2)
- 网络 (2)
- windows (2)
- nodejs (1)
最新评论
-
yhyx:
好
JAVA URI URL区别 -
dingbuoyi:
我文章很早以前写的啊 估计软件版本早更新了 你要自己研究一下
windows下Sublime Text 2开发 Nodejs -
di1984HIT:
写的很好,学习了
【转帖】IP网段的计算和划分 -
农民柏柏:
感谢分享
【转】Android实现人人网点击“+”弹出效果 -
lianwanf:
大神,求源码,很想要那jar包.官方的不懂下载啊.谢谢啊. ...
开源框架ignition[二]
原文http://googletesting.blogspot.jp/2010/12/test-sizes.html
by Simon Stewart
What do you call a test that tests your application through its UI? An end-to-end test? A functional test? A system test? A selenium test? I’ve heard all them, and more. I reckon you have too. Tests running against less of the stack? The same equally frustrating inconsistency. Just what, exactly, is an integration test? A unit test? How do we name these things?
Gah!
It can be hard to persuade your own team to settle on a shared understanding of what each name actually means. The challenge increases when you encounter people from another team or project who are using different terms than you. More (less?) amusingly, you and that other team may be using the same term for different test types. “Oh! That kind of integration test?” Two teams separated by a common jargon.
Double gah!
The problem with naming test types is that the names tend to rely on a shared understanding of what a particular phrase means. That leaves plenty of room for fuzzy definitions and confusion. There has to be a better way. Personally, I like what we do here at Google and I thought I’d share that with you.
Googlers like to make decisions based on data, rather than just relying on gut instinct or something that can’t be measured and assessed. Over time we’ve come to agree on a set of data-driven naming conventions for our tests. We call them “Small”, “Medium” and “Large” tests. They differ like so:
Feature Small Medium Large
Network access No localhost only Yes
Database No Yes Yes
File system access No Yes Yes
Use external systems No Discouraged Yes
Multiple threads No Yes Yes
Sleep statements No Yes Yes
System properties No Yes Yes
Time limit (seconds) 60 300 900+
Going into the pros and cons of each type of test is a whole other blog entry, but it should be obvious that each type of test fulfills a specific role. It should also be obvious that this doesn’t cover every possible type of test that might be run, but it certainly covers most of the major types that a project will run.
A Small test equates neatly to a unit test, a Large test to an end-to-end or system test and a Medium test to tests that ensure that two tiers in an application can communicate properly (often called an integration test).
The major advantage that these test definitions have is that it’s possible to get the tests to police these limits. For example, in Java it’s easy to install a security manager for use with a test suite (perhaps using @BeforeClass) that is configured for a particular test size and disallows certain activities. Because we use a simple Java annotation to indicate the size of the test (with no annotation meaning it’s a Small test as that’s the common case), it’s a breeze to collect all the tests of a particular size into a test suite.
We place other constraints, which are harder to define, around the tests. These include a requirement that tests can be run in any order (they frequently are!) which in turn means that tests need high isolation --- you can’t rely on some other test leaving data behind. That’s sometimes inconvenient, but it makes it significantly easier to run our tests in parallel. The end result: we can build test suites easily, and run them consistently and as as fast as possible.
Not “gah!” at all.
引用
by Simon Stewart
What do you call a test that tests your application through its UI? An end-to-end test? A functional test? A system test? A selenium test? I’ve heard all them, and more. I reckon you have too. Tests running against less of the stack? The same equally frustrating inconsistency. Just what, exactly, is an integration test? A unit test? How do we name these things?
Gah!
It can be hard to persuade your own team to settle on a shared understanding of what each name actually means. The challenge increases when you encounter people from another team or project who are using different terms than you. More (less?) amusingly, you and that other team may be using the same term for different test types. “Oh! That kind of integration test?” Two teams separated by a common jargon.
Double gah!
The problem with naming test types is that the names tend to rely on a shared understanding of what a particular phrase means. That leaves plenty of room for fuzzy definitions and confusion. There has to be a better way. Personally, I like what we do here at Google and I thought I’d share that with you.
Googlers like to make decisions based on data, rather than just relying on gut instinct or something that can’t be measured and assessed. Over time we’ve come to agree on a set of data-driven naming conventions for our tests. We call them “Small”, “Medium” and “Large” tests. They differ like so:
Feature Small Medium Large
Network access No localhost only Yes
Database No Yes Yes
File system access No Yes Yes
Use external systems No Discouraged Yes
Multiple threads No Yes Yes
Sleep statements No Yes Yes
System properties No Yes Yes
Time limit (seconds) 60 300 900+
Going into the pros and cons of each type of test is a whole other blog entry, but it should be obvious that each type of test fulfills a specific role. It should also be obvious that this doesn’t cover every possible type of test that might be run, but it certainly covers most of the major types that a project will run.
A Small test equates neatly to a unit test, a Large test to an end-to-end or system test and a Medium test to tests that ensure that two tiers in an application can communicate properly (often called an integration test).
The major advantage that these test definitions have is that it’s possible to get the tests to police these limits. For example, in Java it’s easy to install a security manager for use with a test suite (perhaps using @BeforeClass) that is configured for a particular test size and disallows certain activities. Because we use a simple Java annotation to indicate the size of the test (with no annotation meaning it’s a Small test as that’s the common case), it’s a breeze to collect all the tests of a particular size into a test suite.
We place other constraints, which are harder to define, around the tests. These include a requirement that tests can be run in any order (they frequently are!) which in turn means that tests need high isolation --- you can’t rely on some other test leaving data behind. That’s sometimes inconvenient, but it makes it significantly easier to run our tests in parallel. The end result: we can build test suites easily, and run them consistently and as as fast as possible.
Not “gah!” at all.
发表评论
-
listview 几个重要属性
2012-06-20 06:54 1019参考资料 http://www.cnblogs ... -
android项目mvn开发
2012-06-19 07:12 973项目主页 http://code.google.com/p/m ... -
你真的会用AsyncTask吗
2012-06-24 19:24 1515一个典型的AsyncTask应用 public class ... -
关于AsyncTask的RejectedExecutionException异常
2012-06-24 19:24 3221当运行的AsyncTask 实例数量过多的时候会引发Rejec ... -
android.view.WindowManager$BadTokenException: Unable to add window -- token andr
2012-06-08 09:59 13103因为使用了AsyncTask 异步线程在线程完成以后的onPo ... -
ADT 17 导入JAR包
2012-06-07 17:48 1202引用 Eclipse ADT 17 以上版本用户,请在工程目录 ... -
android textview 自动链接网址 修改默认点击事件
2012-06-06 18:04 108131 修改XML文件即可,android:autoLink=&q ... -
【转】Android项目更换开发环境时出现的 java.lang.VerifyError 异常解决办法
2012-06-06 07:55 977引用 项目是从同事的电脑上直接拷贝过来的,项目里面的jar包是 ... -
android 判断Service是否开启
2012-05-31 10:12 3541被判断的Service 必须是带包名的全名 通过Servic ... -
android 写入收件箱
2012-05-21 10:58 856<uses-permission android: ... -
ndroid junit入门(四)Service测试
2012-05-18 11:26 807public class TestService exte ... -
android junit入门(三)Application测试
2012-05-18 10:54 1147测试Application public class T ... -
android junit入门(二)Activity测试
2012-05-18 10:38 2367测试ACTIVITY 直接上类了 public clas ... -
android junit入门(一) JUNIT测试
2012-05-18 09:54 1365新建ANDROID TEST项目 ECLIPSE右键--> ... -
imagebutton 带文字
2012-05-16 13:59 927<FrameLayout ... -
android orm
2012-05-10 17:58 1006选择了http://ormlite.com/ 里面还支持AN ... -
android 隐藏虚拟按键
2012-05-09 16:14 11227一 全部隐藏 可以试下 <uses-sdk andro ... -
android 切图
2012-05-03 15:19 14741 程序launcher icons规格 3 ... -
新浪微博API杂记
2012-05-02 17:14 9331 获取指定用户的微博 https://api.weibo.c ... -
获取新浪微博的ACCESS_TOKEN
2012-05-02 16:00 58151 https://api.weibo.com/oauth2/ ...
相关推荐
例如,`@UiThreadTest`注解用于表示该测试必须在主线程运行,而`@SmallTest`, `@MediumTest`, 和 `@LargeTest` 分别代表不同的测试规模。 文件列表中的`runnerdemo.tar.gz`和`junit_demo1.tar.gz`可能包含了示例...
在Android开发中,JUnitTest是进行单元测试的重要工具,它基于Java的JUnit框架,使得开发者能够在Android环境中对代码进行验证和测试。本文将详细介绍如何在Android项目中设置和使用JUnitTest用例,以及如何通过...
这个名为"Junit_test.rar"的压缩包显然包含了一个关于JUnit的示例程序,旨在帮助学习者更好地理解和应用JUnit进行测试。 在Java开发中,单元测试是对代码的最小可测试单元进行验证的过程,例如单个方法。JUnit提供...
import androidx.test.ext.junit.runners.AndroidJUnit4; @RunWith(AndroidJUnit4.class) public class MainActivityTest { @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule...
一个简单的Android JUnit测试类通常会继承自`androidx.test.ext.junit.runners.AndroidJUnit4`。这个运行器使得我们可以在Android环境中使用JUnit 4的特性。例如: ```java import androidx.test.ext.junit.runners...
`android-junit5`插件提供了一个`test`任务,可以覆盖默认的`testDebugUnitTest`任务: ```groovy apply plugin: 'de.mannodermaus.android-junit5' android { // ... } tasks.test { useJUnitPlatform() } ```...
Android JUnit 单元测试 在 Android 应用开发中,单元测试是一个非常重要的步骤。单元测试可以帮助开发者快速地检测应用中的错误和问题,从而提高应用的质量和 stability。Android JUnit 是一个基于 JUnit 框架的...
JUnit作为Java领域最流行的测试框架,提供了丰富的功能来帮助开发者编写高效、可靠的测试用例。在本文中,我们将深入探讨如何在JUnit中利用`@Rule`注解来测试文件和目录,从而提升测试的覆盖率和实用性。 `@Rule`是...
测试类需要继承`androidx.test.ext.junit.runners.AndroidJUnit4`,并使用`@Test`注解标记测试方法。例如: ```java import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; public class...
在Java的单元测试框架JUnit 5中,`@ParameterizedTest` 和 `@EnumSource` 是两种非常实用的注解,它们可以有效地提高测试代码的复用性和覆盖率。`@ParameterizedTest` 允许我们将测试方法参数化,也就是说,同一个...
在Android开发中,JUnit结合了Android Testing Support Library,提供了一些专门为Android环境设计的测试工具,如`@UiThreadTest`用于在UI线程上运行的测试,`@SmallTest`, `@MediumTest`, `@LargeTest`用于标记不同...
AndroidJUnit是Android平台上进行单元测试的关键工具,它基于Java的JUnit框架,允许开发者对应用程序的代码进行自动化测试。在Android开发中,单元测试是确保代码质量、可维护性和避免引入bug的重要环节。本资料详细...
要开始使用JUnit4进行Android测试,你需要创建一个测试类,这个类通常会放在项目的`src/test/java`目录下,并且需要继承`androidx.test.ext.junit.runners.AndroidJUnit4`。这个测试类中的方法会被识别为测试用例,...
1. **注解(Annotations)**:JUnit 4.7的一大亮点就是使用注解(@Test, @Before, @After等)来标记测试方法、设置初始化和清理操作。这使得测试类的结构更清晰,代码更易读。 2. **参数化测试**:允许用不同的参数...
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' ``` 这样,你就可以在Android Studio中编写和运行JUnit测试了。 2. **...
1. **缺少JUnit库**:如果项目中没有正确地导入JUnit相关的jar包,那么编译器无法识别@Test注解,导致测试无法执行。你需要确保项目构建路径中包含了JUnit的库文件,通常是`junit-4.x.jar`或更高版本。 2. **JUnit...
### Android Studio中的JUnit调试 #### 一、JUnit简介 JUnit是一种用于Java编程语言的单元测试框架,它最初由Kent Beck和Erich Gamma开发,并作为XUnit家族的一员而广为人知。JUnit的设计目的是为了帮助开发者编写...
JUnit3的测试类需要遵循特定的命名规则,比如测试方法必须以`test`作为前缀。而JUnit4引入了注解(annotation)机制,极大地简化了测试代码,使得编写和执行测试更加方便。使用JUnit4时,需要注意你的JDK版本应为1.5...