Currently I do most of my development in VScode using sfdx.
For writing test classes, I need to see which lines are covered in Apex classes I write.
In DX, running commands (see below) to get coverage result takes very long (perhaps more than three minutes when Apex test execution time is less than five seconds).
sfdx force:apex:test:run --classnames AnApexClass --resultformat json --outputdir d:\VScode projects\example\.sfdx\tools\testresults\apex --loglevel error --codecoverage
Therefore I usually use Developer Console for doing this job. In Developer Console, the coverage result usually comes out right after the test methods finish executing. The downside of Developer console is that after each test run, I still need to find the Apex class I want by scrolling down in the "Overall Code Coverage" section. This is also quite time consuming when I need to run the test a couple of times.
I would like to ask if there is any way to make retrieving coverage result faster in DX?
Or, if there is any other tool better than Developer Console or DX?
Thanks.
sfdx force:apex:test:run -n TestClassName -r human -c
. Have you tried clicking on ""Run all Tests" in the Apex test itself in the VS editor to see if that is faster? Also, might be useful to make sure you're on the latest update withsfdx update