首页 > 其他 > 详细

测试与优化

时间:2018-09-30 11:58:33      阅读:169      评论:0      收藏:0      [点我收藏+]

测试与优化

211606390张晋誌 211606329 王浩

单元测试

思路

分析可能出现的情况,运用代码进行测试。

代码

@RunWith(Parameterized.class)
public class ParameterTest{
    int expected=0;
    String input1="";
    String input2="";
    String input3="";
    String input4="";


    @Parameters
    public static Collection<Objcet[]>t(){
        return Arrays.asList(new Object[][]{
            {0,"-n","-grade","2","2"},
            {1,"-n","10","-grade","1"},
            {1,"-grade","1","-n","10"},
            {0,"-n","-1","-grade","1"},
            {0,"-n","10","-grade","7"},
            {0,"-n","0","-grade","1"},
            {0,"-n","1002","-grade","2"}
        });
}

public ParameterTest(int expected,String input1,String input2,String input3,String input4){
    this.expected=expected;
    this.input1=input1;
    this.input2=input2;
    this.input3=input3;
    this.input4=input4;
    }
}
@BeforeClass
    public static void setUpBeforeClass() throws Exception {
        start=0;
    }


@Test
    public void Mathtest() {
        assertEquals(expected, new MathExam6329(input1,input2,input3,input4).start);;
    }

运行流程图

技术分享图片

总结

写了七八天,三年级和逆波兰的算法还是有许多问题解决不了,所以没有进行单元测试,这次作业我深深感受到了自身能力的不足,吃了以前学习不认真基础不扎实的亏,过后要好好研究java,提升自身的能力,为下一次作业提供更好的基础。
技术分享图片

测试与优化

原文:https://www.cnblogs.com/wzxhh/p/9728659.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!