当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

上海交通大学:《软件测试与质量控制》课程教学资源(课件讲稿)chapter 3 Test environment and tools

资源类别:文库,文档格式:PDF,文档页数:37,文件大小:1.02MB,团购合买
点击下载完整版文档(PDF)

上游充通大皇 SJTU School Of Software 2009-2-3 Chapter 3 Test environment and tools 软件学院

SJTU School Of Software 2009-2-3 软件学院 Chapter 3 Test environment and tools

上游充鱼大警 SJTU School Of Software 2009-2-3 3.1 Java Why is Java Easy to get source code and documentation Completed test environment More free test tools J2SE Development kit 5.0 http://java.com/en/desktop/ 软件学院

SJTU School Of Software 2009-2-3 软件学院 3.1 Java Why is Java ? ™ Easy to get source code and documentation ™ Completed test environment ™ More free test tools ™ J2SE Development kit 5.0 ™ http://java.com/en/desktop/

上浒充通大 SJTU School Of Software 2009-2-3 3.2 Eclipse Eclipse is a kind of universal platform-an open extensible IDE for anything and nothing in particular.It provides a feature-rich development environment that allows the developer to efficiently create tools that integrate seamlessly into the Eclipse Platform. www.Eclipse.org Example of Eclipse 软件学院

SJTU School Of Software 2009-2-3 软件学院 3.2 Eclipse Eclipse is a kind of universal platform – an open extensible IDE for anything and nothing in particular. It provides a feature-rich development environment that allows the developer to efficiently create tools that integrate seamlessly into the Eclipse Platform. www.Eclipse.org Example of Eclipse

上溶充通大警 SJTU School Of Software 2009-2-3 3.3 JUNIT ,JUnit,是由Erich Gamma和Kent Beck编写的一个回归测试框架 regression testing framework Junit:测试是程序员测试,即所谓白盒 测试,因为程序员知道被测试的软件如 何(How)完成功能和完成什么样 (What)的功能。Junit,是一套框架, 继承TestCase类,就可以用Junit:进行 自动测试了。 必 http://www.junit.org/index.htm 软件学院

SJTU School Of Software 2009-2-3 软件学院 3.3 JUNIT ™ JUnit是由 Erich Gamma 和 Kent Beck 编写的一个回归测试框架 (regression testing framework)。 Junit测试是程序员测试,即所谓白盒 测试,因为程序员知道被测试的软件如 何(How)完成功能和完成什么样 (What)的功能。Junit是一套框架, 继承TestCase类,就可以用Junit进行 自动测试了。 ™ http://www.junit.org/index.htm

上游充鱼大 SJTU School Of Software 2009-2-3 JUNIT 必 For application developers,testing forms an integral part of the development life-cycle. 必 As old code is modified for reasons ranging from adding new functionality to speed optimizations, the risk of dependent functionality getting broken increases. 必 Tests that are written once,and can be run repeatedly is the only solution to avoid manually QA testing. 必 To write these tests,for applications written in java,JUnit provides a solid framework for writing unit tests.Many JUnit integrations also exist to integrate your JUnit tests into build and development tools. 软件学院

SJTU School Of Software 2009-2-3 软件学院 JUNIT ™ For application developers, testing forms an integral part of the development life-cycle. ™ As old code is modified for reasons ranging from adding new functionality to speed optimizations, the risk of dependent functionality getting broken increases. ™ Tests that are written once, and can be run repeatedly is the only solution to avoid manually QA testing. ™ To write these tests, for applications written in java, JUnit provides a solid framework for writing unit tests. Many JUnit integrations also exist to integrate your JUnit tests into build and development tools

上游充道大 SJTU School Of Software 2009-2-3 JUNIT安装 1.http://www.junit.org/index.htm 下载JUNIT包JUNIT.JAR 2.将JAR文件拷贝到JDK的LIB目录, C:\Javaljdk1.5.0llib.. ☆3.在CLASSPATH目录下增加一条 c:\Javaljdk 1.5.0llibljunit.jar; 软件学院

SJTU School Of Software 2009-2-3 软件学院 JUNIT安装 ™ 1. 从http://www.junit.org/index.htm 下载JUNIT包 JUNIT.JAR ™ 2.将JAR文件拷贝到JDK的LIB目录, C:\Java\jdk1.5.0\lib.。 ™ 3. 在CLASSPATH 目录下增加一条 c:\Java\jdk 1.5.0\lib\junit.jar;

上游充通大姿 SJTU School Of Software 2009-2-3 在Eclipse中使用JUNIT 必 测试对于保证软件开发质量有着非常重要的作 用,单元测试更是必不可少,JUnit是一个非常 强大的单元测试包,可以对一个/多个类的单个/ 多个方法测试,还可以将不同的TestCase组合 成TestSuit,使测试任务自动化。Eclipse同样 集成了JUnit,可以非常方便地编写TestCase。 我们创建一个Java工程,添加一个 example.Hello类,首先我们给Hello类添加一 个abs(0方法,作用是返回绝对值: 软件学院

SJTU School Of Software 2009-2-3 软件学院 在Eclipse中使用JUNIT ™ 测试对于保证软件开发质量有着非常重要的作 用,单元测试更是必不可少,JUnit是一个非常 强大的单元测试包,可以对一个/多个类的单个/ 多个方法测试,还可以将不同的TestCase组合 成TestSuit,使测试任务自动化。Eclipse同样 集成了JUnit,可以非常方便地编写TestCase。 ™ 我们创建一个Java工程,添加一个 example.Hello类,首先我们给Hello类添加一 个abs()方法,作用是返回绝对值:

上浒充通大学 SJTU School Of Software 2009-2-3 D Hello.iava 1 package example; 2 3vpublic class Hello 4 5 public static void main(String[]args)( 8 99 public int abs(int n){ 10 return n>=0 n (-n) 12 软件学院

SJTU School Of Software 2009-2-3 软件学院

上游充通大 SJTU School Of Software 2009-2-3 下一步,我们准备对这个方法进行测试,确保功能正 常。选中Hello.java,右键点击,选择New->JUnit Test Case: Packaoe Explorerx JUnit -☐CrystalBlog Hello 白src 白由 example DHello.java JRE Syst Ne型 Project... 由JUNIT_H 合classes Open F3 审Package dist Open With docs F4 Class Open Type Hierarchy 合b Interface report 自Copy Ctrl+C 影buld,xml Source Folder 色Paste Ctrl+V ▣Jexi Folder ▣petstore Delete Delete 子File SendMail Source Alt+Shift+S Refactor Alt+Shift+T 目JUnit Test Case Import... other... Ctrl+N 2☑Export.. 软件学院

SJTU School Of Software 2009-2-3 软件学院 下一步,我们准备对这个方法进行测试,确保功能正 常。选中Hello.java,右键点击,选择New->JUnit Test Case:

上浒充通大粤 SJTU School Of Software 2009-2-3 Eclipse会询问是否添加junit,.jar包,确定后新建一个HelloTest类, 用来测试Hello类。一般自己导入下载的junit包。 Newy JUnit Test Case JUnit Test Case Select the name of the new JUnit test case.You have the options to specify the class under test and on the next page,to select methods to be tested. Source Folder: Hello/src Browse,.· Package: example Browse.·· Name: HelloTest Superclass: junit.framework.TestCase Browse· Which method stubs would you like to create? public static void main(String[]args) Add TestRunner statement for: text ui setup() tearDown() ■constructor( Class Under Test: example.Hello Browse... 次件学院 Back Next> Finish Cancel

SJTU School Of Software 2009-2-3 软件学院 Eclipse会询问是否添加junit.jar包,确定后新建一个HelloTest类, 用来测试Hello类。一般自己导入下载的junit包

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共37页,可试读13页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有