2

We have high number of test methods. After running all test cases using

sfdx force:apex:test:run

test-result-codecoverage.json doesn't include all classes, it includes only 25% of classes. Is there a way to include coverage from all classes as returned by

SELECT ApexClassOrTrigger.Name,NumLinesCovered,NumLinesUncovered, Coverage FROM ApexCodeCoverageAggregate

When we looked into test-result-{{testId}}.json, it only include 10000 items in coverage.records

1 Answer 1

0

The Salesforce team has identified this as an issue with SFDX CLI from version 7.159 onwards.

A Known Issue has been created with bug #W-11622957 .

Summary
Salesforce CLI version 7.159 included a version bump of the apex-node library from v0.13 --> v1.1. In version 1.1, the apex-node library was upgraded to use more recent versions of salesforce/core and jsforce. The upgrading of core and jsforce seem to have impacted the way the maxQueryLimit is applied when retrieving test report results. Before cli version 7.159, increasing the maxQueryLimit to 1600000 (something higher than the 10k default value) would return all of the covered classes in the coverage report. After 7.159, increasing the maxQueryLimit has no effect, and a test run of many hundreds of files that would produce a coverage file nearing 1M lines instead produces a truncated coverage file that omits some of the covered classes.

Workaround suggested in the known issue is to

Use a older version of SFDX CLI to run the command "sfdx force:apex:test:run" (any version prior to 7.159)

Reported on Github here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .