首页 > 其他 > 详细

软件测试第二次作业(2)

时间:2016-03-26 23:34:26      阅读:220      评论:0      收藏:0      [点我收藏+]

第二题

实现代码如下:

package com.liu.ST2;

import java.util.Scanner;

public class Question2 {

public static void reverse(String[] args) {

Scanner input = new Scanner(System.in);

System.out.print("请输入英文:");

String str = input.nextLine();

String[] strArr = str.split("\\s+|[,]");

StringBuffer result = new StringBuffer();

for (int i = strArr.length - 1; i >= 0; i--) {

result.append(strArr[i] + " ");

}

result.setCharAt(str.length() - 0, ‘ ‘);

System.out.println("颠倒顺序后的结果为:" + result.toString());

}
}

Junit测试代码如下:

package com.liu.ST2;

import static org.junit.Assert.*;

import org.junit.Test;

public class Question2Test {

@Test
public void test() {
Question2 q2 = new Question2();
q2.reverse(null);;
}

}

Junit测试及ElcEmma覆盖率如下:技术分享

因第二次只测试第二题,并没有测试第一题,所以第一题的覆盖率为0%.

软件测试第二次作业(2)

原文:http://www.cnblogs.com/lmxiyt/p/5324321.html

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