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:

        

        

  • 相关阅读:
    PHP程序十点未来的建议
    网站入侵思路
    SQL注入初探
    php安全学习笔记
    BLE协议分析
    调用NMAP批量扫描IP端口
    安卓系统手机目录
    xss绕过过滤方法
    xss测试用例
    python爬虫
  • 原文地址:https://www.cnblogs.com/3013218071zjr/p/5292627.html
Copyright © 2011-2022 走看看