-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sf apex get test command returns 0% apex test coverage #2963
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
Hey, my friends on Apex looked at this and you need to use |
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted. |
Hi @mshanemc, Adding the --code-coverage flag to the apex run test command changes the return behavior of the command. Running the command WITHOUT the code coverage flag returns the test run id, if the execution of the unit tests takes longer than the wait time. sf apex run test --json --result-format json --suite-names sophos_service_tests --target-org <TARGET_ORG> --output-dir tests_run_scratch/ --wait 1 Returns: whilst running the command WITH the code coverage flag returns an error if the execution of the unit tests takes longer than the wait time. sf apex run test --code-coverage --json --result-format json --suite-names sophos_service_tests --target-org <TARGET_ORG> --output-dir tests_run_scratch/ --wait -1 Returns: What we expect is for the apex run command with code coverage flag returns the test run id as well if the apex test execution takes longer than the wait time. |
Hey @kez-sophos, sorry for the delay on this. I was able to replicate that error. After some testing I noticed that if you don't use the So you could:
I am checking with another team about this behavior. |
This issue has been linked to a new work item: W-16441400 |
I've got a ticket created to handle the combination of these flags better. In the meantime, use the workaround above. Thanks! |
Summary
sf apex get test command returns 0 totalCovered and 0 coveredPercent
Steps To Reproduce
sf apex run test --json --result-format json --suite-names TEST_SUITE_NAME --target-org ORG --output-dir tests_run_scratch/ --wait 1
3, Get apex test result
sf apex get test --json --code-coverage --result-format json --target-org ORG --output-dir tests_run_scratch/ --test-run-id TEST_ID
can retrieve test id by running the query in the test org (AsyncApexJobId): SELECT Status, AsyncApexJobId FROM ApexTestRunResult
Expected result
apex get test command returns accurate line and percent, test coverage for apex classes
Actual result
apex get test command returns 0 line and percent, test coverage for apex classes
System Information
cmd.exe
Additional information
The text was updated successfully, but these errors were encountered: