Skip to main content

Quick Navigation

Overview

Velocity macros in TestAuto2 serve three primary functions:
  1. UI Components — Reusable HTML/CSS widgets for dashboards (banners, cards, grids, tables)
  2. Data Functions — Query and aggregate work items and documents from Polarion
  3. Formatting — Apply conditional styling (traffic lights, progress bars, color coding)
All macros are defined in .polarion/pages/scripts/velocity/nextedy_solutions.vm and imported by dashboard and report pages.

Key Features

  • :fontawesome-solid-check: Traffic Light Styling — Color-coded cells based on completion thresholds (green ≥ 80%, yellow 50–79%, red < 50%)
  • :fontawesome-solid-gauge: Live Metrics — Real-time traceability, coverage, and compliance calculations
  • :fontawesome-solid-link: Link Aggregation — Count and visualize relationships across work item types
  • :fontawesome-solid-chart-pie: Risk Matrices — Severity/probability grids for HARA, FMEA, and HAZID
  • :fontawesome-solid-layer-group: Hierarchical Display — Render system structures, document trees, and nested data
  • :fontawesome-solid-palette: Conditional Formatting — Apply CSS classes and tooltips dynamically

Macro Categories

CategoryPurposeExample Macros
UI ContainersPage structure and layout#nxReportBanner(), #nxSectionHeader()
Cards & GridsStatistics and KPI display#nxStatCard(), #nxKpiCard(), #nxLinkCard()
Data QueryWork item aggregation#nxLinkCoverage(), #nxCountByEnum()
Risk AnalysisFMEA and hazard rendering#nxFmeaElementBlock(), #nxRiskMatrix()
NavigationDocument tree and structure#nxDocInventoryTree()
Progress & StatusCompletion tracking#nxCoverageBar()

Common Usage Patterns

Query Work Items by Type

#set($allHazards = $transaction.workItems().search()
    .query("project.id:$projectId AND type:hazard").getAll())
#set($hazardCount = $allHazards.size())

Access Enumeration Fields

#set($asil = $item.fields().get("classification").get()
    .getReference().id())

Calculate Coverage Percentage

#set($coveredCount = 5)
#set($totalCount = 10)
#set($pct = $math.round(($coveredCount / $totalCount) * 100))

Apply Conditional CSS

#if($pct >= 80)
    #set($cellClass = "nx-cell-green")
#elseif($pct >= 50)
    #set($cellClass = "nx-cell-yellow")
#else
    #set($cellClass = "nx-cell-red")
#end
<div class="$cellClass">$pct%</div>

Macro Scope and Context

Each macro call has its own variable scope. To return multiple values, macros set module-level variables (prefixed with $nx). For example, #nxLinkCoverage() sets $nxLcCovered and $nxLcTotal.
Velocity’s #foreach loops and macro scoping can create complexity when counting enum values. Use explicit iteration with #set() to accumulate counts across collections.

Architecture Diagram

diagram