结对项目 刘静 201303014059 计科高职13-2

结对:人:孙帅  博客地址:

一、  题目简介

1.所选题目:输出圆的面积

2.编程工具:Eclipse

3、实现功能:用户给定一圆的半径运行程序系统会给出给定半径圆的面积。

二、结对分工及过程;

我负责JUnit4测试这部分,孙帅同学负责圆的面积计算的代码编写。

三、代码地址;

https://github.com/liujing1994/TestCircle 

四、测试情况;

 所设计的模块测试用例:

public class TestCircle3 {

      /** Main method */

      public static void main(String[] args) {

        // Create a Circle with radius 5.0

        Circle3 myCircle = new Circle3(5.0);

        System.out.println("The area of the circle of radius "

          + myCircle.getRadius() + " is " + myCircle.getArea());

        // Increase myCircle's radius by 10%

        myCircle.setRadius(myCircle.getRadius() * 1.1);

        System.out.println("The area of the circle of radius "

          + myCircle.getRadius() + " is " + myCircle.getArea());

      }

}

 

 

import static org.junit.Assert.*;

 

import org.junit.Before;

import org.junit.Test;

 

public class TestCircle3Test extends TestCircle3 {

 

    @Before

    public void setUp() throws Exception {

    }

 

    @Test

    public void test() {

        fail("Not yet implemented");

    }

}

测试结果截图:

 

 

 

五、问题及心得

     在这次试验中,我练习了如何通过JUnit4选用测试用例给主类测试,在测试过程中,我的程序出现了“共测试了1个测试,0个被忽略,1个测试失败”,后来通过代码的修改,最终还是成功了。所以,编程序不能急于求成,要有耐心,有定力。

 

posted @ 2015-05-17 10:49  我想静静,哈哈哈  阅读(166)  评论(7编辑  收藏  举报