Command Line Export

Coverage Validator can be controlled from the command line prompt.

This tutorial describes in detail how to collect code coverage for an application then export the data in HTML, XML and Cobertura formats from the command line.

Sharing your code coverage data without needing the other person to use Coverage Validator is really useful. You can export as HTML for posting on the company intranet. You can export as XML or Cobertura formats for consumption by other testing tools.

HTML

The command line is:

coverageValidator.exe -program "c:\test results\testbed.exe"
                      -exportAsHTML "c:\test results\test100.html" 
                      -exportAsHTML_BOM UTF16
                      -exportVisitedLines:On
                      -exportUnvisitedLines:On
                      -exportVisitedFunctions:On
                      -exportUnvisitedFunctions:On
                      -exportDetailedReport:On
                      -exportDoColourCode:On
                      -exportFileFormatCRLF
                      -exportSourceCode:On
                      -exportType SummaryAndCoverage
                      -hideUI

The above command line can be broken into its constituent items:

  • Specify the program to run. -program “c:\test results\testbed.exe”
  • The exported HTML is saved in c:\test results\test100html. -saveSession “c:\test results\test100.html”
  • The exported HTML is export in UTF16 format -exportAsHTML_BOM UTF16
  • The exported HTML contains data about visited lines -exportVisitedLines:On
  • The exported HTML contains data about unvisited lines -exportUnvisitedLines:On
  • The exported HTML contains data about visited functions -exportVisitedFunctions:On
  • The exported HTML contains data about unvisited functions -exportUnvisitedFunctions:On
  • The exported HTML has extra detail -exportDetailedReport:On
  • The exported HTML is colour coded -exportDoColourCode:On
  • The exported HTML use \r\n for line endings. -exportFileFormatCRLF
  • The exported HTML contains source code -exportSourceCode:On
  • The exported HTML layout is a summary (like the summary tab) and detailed code coverage -exportType SummaryAndCoverage
  • Run Coverage Validator with the user interface hidden. -hideUI

This command line runs the test program. When the test program closes the code coverage results are finalised then export in HTML to c:\test results\test100.html. Each source code file has coverage reported in it’s own HTML file linked from the main file test100.html. Finally Coverage Validator is closed.

XML

The command line is:

coverageValidator.exe -program "c:\test results\testbed.exe"
                      -exportAsXML "c:\test results\test100.xml" 
                      -hideUI

The above command line can be broken into its constituent items:

  • Specify the program to run. -program “c:\test results\testbed.exe”
  • The exported XML is saved in c:\test results\test100xml. -saveSession “c:\test results\test100.xml”
  • Run Coverage Validator with the user interface hidden. -hideUI
  • Any arguments not explicitly specified (as in the HTML example) will use the current settings specified in Coverage Validator

This command line runs the test program. When the test program closes the code coverage results are finalised then export in XML to c:\test results\test100.xml. Finally Coverage Validator is closed.

Coberatura XML

The command line is:

coverageValidator.exe -program "c:\test results\testbed.exe"
                      -exportAsXMLCobertura "c:\test results\test100.xml" 
                      -hideUI

The above command line can be broken into its constituent items:

  • Specify the program to run. -program “c:\test results\testbed.exe”
  • The exported Cobertura XML is saved in c:\test results\test100xml. -saveSession “c:\test results\test100.xml”
  • Run Coverage Validator with the user interface hidden. -hideUI
  • Any arguments not explicitly specified (as in the HTML example) will use the current settings specified in Coverage Validator

This command line runs the test program. When the test program closes the code coverage results are finalised then export in Coberatura XML to c:\test results\test100.xml. Finally Coverage Validator is closed.

Command Line Builder

If you find writing command line tiresome, and you’d like some help we have created a command line builder tool to make the process of creating command lines a lot easier.

Fully functional, free for 30 days