zoukankan      html  css  js  c++  java
  • 第三次作业+105032014052

    测试代码:http://www.cnblogs.com/cyk0674804/p/6591815.html

    1、修正流程图:根据新修改的代码,再次修正流程图

    2、测试用例设计:依据所有的覆盖理论,分别写出相应的测试用例设计。

    3、单元测试框架:采用单元测试框架Junit,初步简单的自动化执行测试用例。

    package main;
    
    import static org.junit.Assert.*;
    import junit.framework.Assert;
    
    import org.junit.Before;
    import org.junit.Test;
    
    public class qqq {
    
    	@Before
    	public void testTriangle() {
    		String string=null;
            string=Demo.triangle(100, 100, 100);
            Assert.assertEquals("等边三角形", string);//1
            string=Demo.triangle(0, 0, 0);
            Assert.assertEquals("边的值不在范围内!", string);//2
            string=Demo.triangle(101, 101, 101);
            Assert.assertEquals("边的值不在范围内!", string);//3
            string=Demo.triangle(3, 4, 5);
            Assert.assertEquals("直角三角形", string);//4
            string=Demo.triangle(2, 1, 1);
            Assert.assertEquals("不能构成三角形", string);//5
            string=Demo.triangle(1, 2, 1);
            Assert.assertEquals("不能构成三角形", string);//6
            string=Demo.triangle(1, 1, 2);
            Assert.assertEquals("不能构成三角形", string);//7
            string=Demo.triangle(1, 5, 5);
            Assert.assertEquals("等腰三角形", string);//8
            string=Demo.triangle(2, 1, 2);
            Assert.assertEquals("等腰三角形", string);//9
            string=Demo.triangle(2, 2, 1);
            Assert.assertEquals("等腰三角形", string);//10
            string=Demo.triangle(6, 7, 8);
            Assert.assertEquals("一般三角形", string);//11
    	}
    
    	@Test
    	public void testMain() {
    		
    	}
    	
    
    }
    

      

    3、测试结果:根据测试用例设计,执行测试,并给出TestRunner测试结果图。17行有错 。。程序有点小BUG,

    4、测试小结:

    •      测试用例编写的心得体会:对软件测试的junit测试有了一些初步的了解 ,以后会继续深入学习
    •      采用单元测试框架,和用main()方法调用的心得体会,可以使用java的断言类Assert 来进行单元测试,在同一个工程下新建一个包
    •      调试与测试的不同体会。
  • 相关阅读:
    写360搜索网页总结
    display和position以及其余标签的使用
    MySQL中的 show index命令
    MySQL中查看索引使用情况
    分布式存储容错原理
    MySQL中通过trace分析优化器跟踪SQL
    MySQL中的 show profile 分析sql
    MySQL 中的 dual表
    Every derived table must have its own alias(sql语句错误解决方法)
    MySQL 中的 explain 语句各字段解释
  • 原文地址:https://www.cnblogs.com/zbxun/p/6646503.html
Copyright © 2011-2022 走看看