JUnit4 TestnullJUnit testJUnit testHenry Zhu
20-June-2013JUnit jump-startJUnit jump-startNever in the field of software development was so much owed by so many to so few lines of code —Martin Fowler
JUnit (http://www.junit.org) is open source software, released under IBM...
nullJUnit testJUnit testHenry Zhu
20-June-2013JUnit jump-startJUnit jump-startNever in the field of software development was so much owed by so many to so few lines of code —Martin Fowler
JUnit (http://www.junit.org) is open source software, released under IBM’s Common
Public License Version 1.0 and hosted on SourceForgeExploring core JUnit-ExampleExploring core JUnit-Exampleimport static org.junit.Assert.assertEquals;
import org.junit.Test;
public class CalculatorTest {
@Test
public void testAdd() {
Calculator calculator = new Calculator();
double result = calculator.add(1, 1);
assertEquals(2, result, 0);
}
}Exploring core JUnit-AssertExploring core JUnit-AssertnullJUnit core objectsJUnit core objectsJUnit Test RunnerJUnit Test RunnerComposing a suite of test classesComposing a suite of test classesJUnit designed the Suite to run one or more test casesTimeout TestingTimeout Testing@Test(timeout=130)Testing exception handlingTesting exception handling@Test(expected=RuntimeException.class)Measuring test coverageMeasuring test coverageCobertura is a code coverage tool that integrates with JUnit
■ Is free and open source
■ Integrates with Ant and Maven; also callable from a command line
■ Generates reports in HTML or XML
■ Sorts the HTML results by various criteria
■ Computes the percentage of code lines
http://cobertura.sourceforge.net/download.htmlUsing reflection to bypass encapsulationUsing reflection to bypass encapsulationFEST-Reflect framework
FEST-Reflect offers helper classes to access all sorts of Java entities, such as fields, methods, constructors, and even inner classes.
http://code.google.com/p/fest/downloads/listMock FrameworkMock FrameworkEasy Mock
http://sourceforge.net/projects/easymock/files/
Deployment of Jenkins serverDeployment of Jenkins serverJUnit reportJUnit reportTest cases coverage rate reportTest cases coverage rate reportAnt scripts of generating JUnit reportAnt scripts of generating JUnit reportQuestion & AnswerQuestion & Answer
?
本文档为【JUnit4 Test】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。