1. 程式人生 > >結對第二次作業

結對第二次作業

總結 選擇運算符 rac ID sse 條件覆蓋 練習 port src

軟件工程結對編程第二次作業

四則運算要求

  • 能夠自動生成四則運算練習題
  • 可以定制題目數量
  • 用戶可以選擇運算符
  • 用戶設置最大數(如十以內、百以內等)
  • 用戶選擇是否有括號、是否有小數
  • 用戶選擇輸出方式(如輸出到文件、打印機等)
  • 最好能提供圖形用戶界面(根據自己能力選做,以完成上述功能為主)

    本次任務中扮演的角色及任務要求

    ??在本次結對作業中我是一名領航員,負責輔助駕駛員完成全部代碼工作,並且為關鍵函數選用合適的覆蓋標準設計測試用例,並編寫代碼進行單元自動測試。
    根據代碼檢查表對駕駛員的本次工作進行評價,以及對於本次工作完成500字以上的總結。

    代碼測試

    技術分享圖片
    四則運算代碼
    選用條件覆蓋對關鍵函數測試,代碼如下:

    package softwar;
    import static org.junit.Assert.*;
    import org.junit.Test;
    public class MainTest {
    @Test
    public void test() {
    try {
        Main.PrintQuestionsFile(10, 1, 20, 1, 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test1() {
    try {
        Main.PrintQuestionsFile(10, 1, 20, 1, 0);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test2() {
    try {
        Main.PrintQuestionsFile(10, 1, 20, 0, 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test3() {
    try {
        Main.PrintQuestionsFile(10, 1, 20, 0, 0);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test4() {
    try {
        Main.PrintQuestionsFile(10, 0, 20, 1, 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }@Test
    public void test5() {
    try {
        Main.PrintQuestionsFile(10, 0, 20, 1, 0);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test6() {
    try {
        Main.PrintQuestionsFile(10, 0, 20, 0, 1);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    @Test
    public void test7() {
    try {
        Main.PrintQuestionsFile(10, 0, 20, 0, 0);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }
    }

結對第二次作業