2017 软件测试 实验一

  1. 在eclipse上安装junit, hamcrest and eclemma

  a.打开eclipse,在工作区,右键JRE Systerm Library ->build path ->configure build path ->在Library 中选择 Junit -> ok .完成后成功添加 Junit. 部分截图如下

 

 

  b.下载Junit(4.12), Hamcrest(1.3) 库放入方便的路径,在eclipse工作区,右键JRE Systerm Library ->build path ->configure build path -> Add External JARs –>选择自己下载好的库 –> ok.部分截图如下

 

 

  2.Install Eclemma with Eclipse,打开Eclipse -> help ->Eclipse Marketplace ->搜索 eclemma ->install –> 再按照提示操作即可安装eclemma. 部分截图如下

 

 

  1. Write a java program for the triangle problem and test the program with Junit.代码截图如下

  a.类文件

 

 

  b.junit 测试

 

 

  3. 测试结果

 

 

 

  4.总结

使用单元测试能很好的找到 error 和 failure.  Junit 很实用。

posted on 2017-03-12 12:11  月影霜岚  阅读(192)  评论(0编辑  收藏  举报

导航