Let's say I have two classes
- AccountController - contains logic
- TestCoverage - contains tests for AccountController
With API v32.0 it was (and still is) possible to deploy .zip which contains nothing but package.xml, request a test run, and get coverage result (covered/uncovered lines, and coverage warnings).
With API v34.0 Metadata deploy (with test run) does not return coverage for classes/triggers not included in the package.zip
This can be easily reproduced with workbench and a developer Org.
I will be using two zip files for tests below.
zip files structure is as follows
components-has-class.zip:
- unpackaged\
--- classes\
------ AccountController.cls
------ AccountController.cls-meta.xml
------ TestCoverage.cls
------ TestCoverage.cls-meta.xml
--- package.xml
components-no-class.zip:
- unpackaged\
--- classes\
--- package.xml
Step 1. Test data Preparation
Take components-has-class.zip and deploy it into your test Org
how you do that does not matter. Important part is that these two classes must be in the Org for the next step.
Step 2. API 32.0 - where everything works as expected
login to workbench with you dev Org credential and select API 32.0 (version is important)
deploy components-no-class.zip with following settings:
- allowMissingFiles: true
- checkOnly: true
- runAllTests: false
- runTests: TestCoverage
Leave other settings as in their default values
When deployment completes - observe that workbench returned coverage details for AccountController.cls as well as code coverage warnings.
Step 3. API 34.0 - coverage is not returned
login to workbench with you dev Org credential and select API 34.0 (version is important)
deploy components-no-class.zip with following settings:
- allowMissingFiles: true
- checkOnly: true
- testLevel: RunSpecifiedTests
- runTests: TestCoverage
Leave other settings as in their default values
When deployment completes - observe that workbench did NOT return coverage details for AccountController.cls
Note - this is NOT a workbench issue - the same behaviour can be reproduced if you write your own deployment test e.g. in java using example from the documentation.
Workarounds
- either include all Class/Trigger files you want to get the coverage for in package.zip
- or use tooling API to run tests
Unfortunately both workarounds involve different degree of inconvenience, compared to old deploy/test method.
Does anyone have any suggestions of what else can be done to make good old deploy/test/get-coverage method working again with API v34.0? I can not get back to v32 because my tools have already been updated to v34.0 and metadata deployment no longer works with v32.0 because v34.0 changed signature of some API calls.
Or how to report it to SFDC? (I do not have premier support access)
testLevel
param? It is new.