Trigger Apex Test

Task Id

Version

sfpwowerscript-triggerapextest-task

9.0.3

This task is used to trigger Apex unit tests, and also captures the results as an artifact and publishes the result in the "tests" tab. Supports "RunAllTestsInPackage" test level, which gives option to validate the code coverage of individual classes in the package.

Prerequisites

Install SFDX CLI with sfpowerkit task must be added to the pipeline before utilizing this task

Task Snapshot

Input Parameters
Output Parameters
YAML Example
Input Parameters

Classic Designer Labels are in Bold, YAML Variables are in italics

  • Alias or username of the target org / targetOrg The alias or username of the target org

  • Test Level / testlevel Select the testlevel for this task for the list of possible values: - Run only specified tests / RunSpecifiedTests - Run an apex test suite / RunApexTestSuite - Run Local Tests / RunLocalTests - Run All Tests in the org / RunAllTestsInOrg - Run All Tests in package / RunAllTestsInPackage

  • Tests to be executed / specified_tests A list of apex test classes to be executed, separated by a comma

This field is only visible/valid if the Test Level is "RunSpecifiedTests"

  • Package Name / package

    Specify name of package to run tests for

This field is only visible/valid if the Test Level is "RunAllTestsInPackage"

  • Apex Test Suite / apextestsuite The name of the apex test suite to be executed

This field is only visible/valid if the Test Level is "RunApexTestSuite"

  • Run tests from a single class synchronously / synchronous

    Run tests synchronously

  • Validate code coverage of individual classes / isValidateCoverage

    Verifies whether individual classes meet the minimum code coverage requirement

This field is only visible/valid if the Test Level is "RunAllTestsInPackage"

  • Minimum percentage coverage required per class / coverageThreshold

    Minimum coverage required per class, in order for the task to succeed

This field is only visible/valid if "isValidateCoverage"

  • Project directory / project_directory

    The project directory should contain a sfdx-project.json

  • Wait Time / wait_time The time this task should wait for the result to be generated.

Output Parameters

None

YAML Example
- task: [email protected]<version>
displayName: Trigger Apex Test Task
inputs:
target_org: 'scratchorg'
testlevel: 'RunLocalTests'
wait_time: '60'
isTelemetryEnabled: true

Changelog

  • 9.0.3 Add RunAllTestsInPackage test level #159

  • 8.0.2 Validate code coverage of individual classes for Apex test suite

  • 6.0.4 Refactored to use revamped folder structure

  • 4.0.6 Integration of Error Logs with Github

  • 3.2.0 Fixes for Post Trigger Test Task

  • 3.0.18 Bugfix for stdout buffer running out

  • 3.0.17 Updated with artifact upload and submitting test results in the test tab

  • 2.0.1 Updated with telemetry

  • 1.1.0 Initial Version

Edit on GitHub