zoukankan      html  css  js  c++  java
  • 【软件测试】1st Experiment: Junit, Hamcrest and Eclemma

    1. Experiment Purposes

    1. Install Junit(4.12), Hamcrest(1.3) with Eclipse
    2. Install Eclemma with Eclipse
    3. Write a java program for the triangle problem and test the program with Junit. 

    2. Experiment Procedure

    1. Install the junit and hamcrest: Upload the 'junit-4.12.jar' and the 'hamcrest-all-1.3.jar' and add them to the new project 'TriangleTest';
    2. Install the EclemmaIn Eclipse: Help -> Install New Software -> add thr url and the name -> finished;
    3. Create the main class to judge wheater it can be a triangle(equilateral,isosceles,scalene) composed by given 3 number(a,b,c);
    4. Create a test class to do the testing, try the '@test, @BeforeClass, @AfterClass, @Before and @After';
    5. Try the coverage.

    3. Experiment Results

    1. Test some annotations

        the source code:

        

        the console output:

        

      2. 4 test cases were used in the test class:(2,2,2), (2,2,1), (4,3,2), (0,3,2), and the result is :

        

      3. Coverage

        in the Triangle.java:

        

        in the TestTriangle.java:

        

        

  • 相关阅读:
    C# FileStream 文件复制
    DataSnap Server 客户端调用 异常
    抛出异常 exception
    RAD Tokyo 10.2.2
    delphi ios info.plist
    sql 日期格式
    sql server 2014登录账号
    sql server导入excel数据
    dev16 cxgrid 在DLL里报0地址错
    sql server 查看所有表记录数
  • 原文地址:https://www.cnblogs.com/3013218071zjr/p/5292627.html
Copyright © 2011-2022 走看看