sf apex run test command: can the "Test Results" and "Apex Code Coverage by Class" rows be sorted?
#3385
AndrewStopchenko-SO
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The problem
When running Apex Tests in a VSCode project, the results seem to pass-through the
sf apex run testoutput. But items in the Test Results and Apex Code Coverage by Class tables don't seem to follow any particular sorting at the moment.Here is an example of the
sf apex run test -c -youtput for the dreamhouse-lwc sample project:This demo project has just 5 ApexClasses that are being tested, and all of them have 100% coverage, but Apex Classes are not sorted alphabetically by the class name:
Imagine scanning through a list of 50+ (shuffled) classes when working on a bigger project, while trying to raise test coverage for a particular Apex class?.. That's my day-to-day if trying to use test results output with VSCode extensions. 😅
Workaround
I often go to the Developer Console > "Tests" bottom tab > "Overall Code Coverage" table, as it allows sorting the aggregated test results by either ClassName, or by Coverage% values. Both sorting options are useful: developer might be interested in finding particular class' Coverage% (then need to sort by ClassName and find the needed row), or, could sort the rows by Coverage% asc/desc to check classes with least/most coverage.
Suggested sorting for CLI command output
"Test Results" table:
${ApexClassName}.${testMethodName})"Apex Code Coverage by Class" table:
Beta Was this translation helpful? Give feedback.
All reactions