testbox.system.coverage

Class CoverageService

lucee.Component
    extended by testbox.system.coverage.CoverageService

Copyright Ortus Solutions, Corp www.ortussolutions.com I handle capturing line coverage data. I can accept the following options: enabled - Boolean to turn coverage on or off sonarQube.XMLOutputPath Absolute XML file path to write XML sunarQube file browser.outputDir Absolute directory path to create html code coverage browser pathToCapture Absolute path to root folder to capture coverage. Typically your web root whitelist A comma-delimited list of file globbing paths relative to your pathToCapture of the ONLY files to match. When emtpy, everything is matched by default blacklist A comma-delimited list of file globbing paths relative to your pathToCapture of files to ignore

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    boolean coverageEnabled
          Coverage Enabled or not.

    • access = public
    • returntype = any
    true false
    any coverageGenerator
          The CoverageGenerator object reference.

    • access = public
    • returntype = any
    true false
    struct coverageOptions
          Struct of coverage options.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init([any coverageOptions='[runtime expression]'])
          Boostrap the Code Coverage service and decide if we'll be enabled or not.
    Method Summary
    CoverageService beginCapture()
         Reset system for a new test.
    CoverageService endCapture([any leaveLineProfilingOn='false'])
         End the capture of data.
    private any generateCoverageData(struct opts)
         Interface with FusionReactor to build coverage data.
    string getCoverageEnabled()
    string getCoverageGenerator()
    string getCoverageOptions()
    any normalizeSlashes([string path])
    private any processCodeBrowser([any qryCoverageData], [any stats], [any opts])
         Generate code browser.
    CoverageService processCoverage(TestResult results, TestBox testbox)
         Process Code Coverage if enabled and set results inside the TestResult object.
    private any processSonarQube(query qryCoverageData, struct opts)
         Write out SonarQube generic coverage XML file.
    private any processStats(query qryCoverageData)
         Generate statistics from the coverage data.
    any renderStats(struct coverageData, [boolean fullPage='true'])
         Render HTML representation of statistics.
    any setCoverageEnabled(boolean coverageEnabled)
    any setCoverageGenerator(any coverageGenerator)
    any setCoverageOptions(struct coverageOptions)
    private any setDefaultOptions([struct opts='[runtime expression]'])
         Default user option struct and do some validation.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init([any coverageOptions='[runtime expression]'])

    Boostrap the Code Coverage service and decide if we'll be enabled or not

    Parameters:
    coverageOptions - struct of options to initialize with

    Property Detail

    coverageEnabled

    property boolean coverageEnabled

    Coverage Enabled or not

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    coverageGenerator

    property any coverageGenerator

    The CoverageGenerator object reference

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    coverageOptions

    property struct coverageOptions

    Struct of coverage options

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    beginCapture

    public CoverageService beginCapture()

    Reset system for a new test. Turns on line coverage and resets in-memory statistics


    endCapture

    public CoverageService endCapture([any leaveLineProfilingOn='false'])

    End the capture of data. Clears up memory and optionally turns off line profiling

    Parameters:
    leaveLineProfilingOn - Set to true to leave line profiling enabled on the server

    generateCoverageData

    private any generateCoverageData(struct opts)

    Interface with FusionReactor to build coverage data

    Parameters:
    opts

    getCoverageEnabled

    public string getCoverageEnabled()


    getCoverageGenerator

    public string getCoverageGenerator()


    getCoverageOptions

    public string getCoverageOptions()


    normalizeSlashes

    public any normalizeSlashes([string path])

    Parameters:
    path

    processCodeBrowser

    private any processCodeBrowser([any qryCoverageData], [any stats], [any opts])

    Generate code browser

    Parameters:
    qryCoverageData
    stats
    opts

    processCoverage

    public CoverageService processCoverage(TestResult results, TestBox testbox)

    Process Code Coverage if enabled and set results inside the TestResult object

    Parameters:
    results - The instance of the TestBox TestResult object to build a report on
    testbox - The TestBox core object

    processSonarQube

    private any processSonarQube(query qryCoverageData, struct opts)

    Write out SonarQube generic coverage XML file

    Parameters:
    qryCoverageData
    opts

    processStats

    private any processStats(query qryCoverageData)

    Generate statistics from the coverage data

    Parameters:
    qryCoverageData

    renderStats

    public any renderStats(struct coverageData, [boolean fullPage='true'])

    Render HTML representation of statistics

    Parameters:
    coverageData
    fullPage

    setCoverageEnabled

    public any setCoverageEnabled(boolean coverageEnabled)

    Parameters:
    coverageEnabled

    setCoverageGenerator

    public any setCoverageGenerator(any coverageGenerator)

    Parameters:
    coverageGenerator

    setCoverageOptions

    public any setCoverageOptions(struct coverageOptions)

    Parameters:
    coverageOptions

    setDefaultOptions

    private any setDefaultOptions([struct opts='[runtime expression]'])

    Default user option struct and do some validation

    Parameters:
    opts - The options to default and check