软件测试上机实验报告

Tasks:

  1. Install Junit(4.12), Hamcrest(1.3) with Eclipse
  2. Install Eclemma with Eclipse
  3. Write a java program for the triangle problem and test the program with Junit.

实验过程:

1. 从办公网上下载junit-4.12.jar和hamcrest-all-1.3.jar包,并通过build path导入。

2. 下载Eclemma并安装,Help —— Eclipse Marketplace —— 搜索Eclemma并安装。

3. 新建st工程文件,test Source Folder,在src 和 test 下建立相同名字的package,将判断三角形形状的文件TriangleType.java写在src下,将判断程序的测试用例等测试文件TestTriangle.java写在test下。

在TriangleType中,分别考虑到“不构成三角形”,“等腰三角形”,“等边三角形”,“直角三角形”和“普通三角形”等几种情况进行判断。

在TestTriangle中使用Junit针对上述各种情况写出测试用例。

4. 使用eclemma测试Coverage。

(居然是100%。。。)

原文地址:https://www.cnblogs.com/Veronica226/p/5291533.html