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

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

资源类别:文库,文档格式:PDF,文档页数:38,文件大小:633.02KB,团购合买
1. Java 2. Eclipse 3. JUNIT 4. EMMA 5. 实例
点击下载完整版文档(PDF)

图 上游充通大学 SHANGHAI JIAO TONG UNIVERSITY Chapter 3 Test environment and tools 1B三

Chapter 3 Test environment and tools

上商充通大 SHANGHAI JIAO TONG UNIVERSITY 1.Java 2.Eclipse 3.JUNIT 4.EMMA 5.实例

1. Java 2. Eclipse 3. JUNIT 4. EMMA 5. 实例

上浒充通大学 SHANGHAI JIAO TONG UNIVERSITY 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/

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/

上游充通大学 SHANGHAI JIAO TONG UNIVERSITY 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

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

上游充通大 SHANGHAI JIAO TONG UNIVERSITY 3.3 JUNIT JUnit是由Erich Gamma和Kent Beck编写的 一个回归测试框架(regression testing framework)。Juniti测试是程序员测试,即所 谓白盒测试,因为程序员知道被测试的软件如 何(How)完成功能和完成什么样(What) 的功能。Junit是一套框架,继承TestCase类, 就可以用Junit:进行自动测试了。 http://www.junit.orq/index.htm

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

上游充通大 JUNIT SHANGHAI JIAO TONG UNIVERSITY 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

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

上浒充通大学 JUNIT安装 SHANGHAI JIAO TONG UNIVERSITY 1.从htto:/ww.junit.org/index.htm下载JUNT包 JUNIT.JAR ④2.将JAR文件拷贝到JDK的LIB目录, C:\Javaljdk1.5.0\lib. g 3.在CLASSPATH目录下增加一条c:\Javaljdk 1.5.0\lib\junit.jar;

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;

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

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

上游充通大¥ SHANGHAI JIAO TONG UNIVERSITY DHello.fava 日 1 package example; 2 3public class Hello 4 5 public static void main(String[]args)( 8 9v public int abs(int n)( 1 return n>=0 2 n (-n); 11 1

上游充通大¥ SHANGHAI JIAO TONG UNIVERSITY 下一步,我们准备对这个方法进行测试,确保功能正常。中 Hello.java,右键点击,选择New->JUnit Test Case: Packaoe Explorer x JUnit -☐CrystalBlog 白Hello 白src 白串 example 中-DHello.java JRE Syst Ne型 Project... JUNIT_H classes Open F3 带Package dist Open With docs Class Open Type Hierarchy F4 合b Interface 合report 自Copy Ctrl+C 黑build,.xml Source Folder 自Paste Ctrl+V ☐Jexi Folder ▣petstore Delete Delete File i-☐SendMail Source Alt+Shift+S Refactor Alt+Shift+T JUnit Test Case Import... other... Ctrl+N E☑Export

下一步,我们准备对这个方法进行测试,确保功能正常。中 Hello.java,右键点击,选择New->JUnit Test Case:

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

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

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