• CodeCover初体验


    国庆刚过完,闲来无事,就随便看看,顺便来了解下一些工具的使用,在工作中要用到的时候可以直接上手。

    CodeCover是一个免费的白盒测试工具,主要测试代码、分支、循环、MC/DC 覆盖。支持为每个测试用例生成独立的报表,目前支持的语言有 Java 和 COBOL。本篇介绍CodeCover作为MyEclipse的插件时的使用。

    官网:http://codecover.org/index.html

    一. 下载安装

    The CodeCover MyEclipse Plugin is installed using the standard Eclipse update mechanism:

    1. Start MyEclipse.
    2. From the main menu, select "Help", "Software updates", "Find and install...".

      

      3. In the upcoming dialog, select "Search for new features to install" and click " "Next".

      

     4. The list containing known update sites will be displayed. Create a new update site by clicking on "New Remote Site..." and enter the following information:

       Name: CodeCover Update Site
       URL:  http://update.codecover.org/
    

    Select the newly created site, if not already selected, and click "Finish". Eclipse will now contact the CodeCover update site; this might take a moment depending on your network connection.

      

     5. In the next dialog, you will see the list of features found on the update site; for now, CodeCover consists of only one feature. Select it for installation and click "Next".

     6. After the download has finished, Eclipse will ask you some questions about the license and installation, and prompt to restart the workbench. You should confirm the restart as not all CodeCover features are guaranteed to work if you simply click "Apply Changes".

      

    Now CodeCover for MyEclipse is installed! You can proceed to the CodeCover Eclipse walkthrough to learn how you can use it.

    二.  使用

     1. Selecting the files to instrument

    Open the Package Explorer view. Choose the Java Classes and Packages you want to instrument and open the context menu by right-clicking on the selected items. The menu item "Use For Coverage Measurement" allows you to toggle the instrumentation state of the selected items.

    选中之后,此类前面就会有一个标记,如下图:

    2.Enabling CodeCover for a Java project

    Open the Properties of your project, e.g. by selecting the project in the Package Explorer and choosing the Properties menu item of the Project menu. Once the Properties are visible, select the CodeCover tab. This tab contains a checkbox which you use to enable/disable CodeCover for the project.

    3.Running a Java project with CodeCover

    Select the CodeCover tab and click on the "Run As"-"CodeCover Measurement " checkbox. Click the Run button to start the application. 

    Once the execution of the application is finished, the gathered coverage data will be shown in the Coverage View.

    4. Test Sessions View

    5. Coverage View

    Last Two View come from Menu(Windows)-Show View-Other:CodeCover

     最后再来工具查看对应的代码:

    讲到这里,CodeCover已讲解完了,对它的基本使用已了解,待日后工作使用到的时候再去详细了解。

  • 相关阅读:
    安装的时候,突然安装程序关闭,的灵异问题。
    CSAPP阅读笔记(1)-序
    CSAPP阅读笔记(2)-虚存管理
    nafxcwd.lib(afxmem.obj) :error LNK2005:"void * __cdecl operator new(unsigned int)"
    Linux内核源代码情景分析读书笔记(5)-关于fork/clone/vfork
    [转]调试经验总结VC下的错误对话框
    IP数据包首部的校验和算法
    Matlab画图及生成exe文件
    VC++6.0中的new
    Linux内核模块编译、加载&卸载及查看运行结果
  • 原文地址:https://www.cnblogs.com/yangxia-test/p/4013494.html
Copyright © 2020-2023  润新知