New test level for metadata deploy - RunTestSuite
See original GitHub issueWhat are you trying to do
It would be nice to be able to specify a test suite name as part of deployment command that would be used to specify which tests should be executed as part of the deployment, as an alternative to the RunSpecifiedTests
option.
For example, if I have apackage with manifest as follows:
package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Foo</members>
<members>FooTest</members>
<members>Bar</members>
<members>BarTest</members>
<name>ApexClass</name>
</types>
<types>
<members>MyTestSuite</members>
<name>ApexTestSuite</name>
</types>
</Package>
And the test suite specifies the tests I want executed during deployment:
MyTestsuite.testSuite
<?xml version="1.0" encoding="UTF-8"?>
<ApexTestSuite xmlns="http://soap.sforce.com/2006/04/metadata">
<testClassName>FooTest</testClassName>
<testClassName>BarTest</testClassName>
</ApexTestSuite>
Describe the solution you’d like
I would like to use a test level named RunTestSuite
for example, that would require a test suite name be specified, possibily by reusing --runtests
or with another flag. With this test level I don’t have to explicitly list all my test classes I want to have run during deployment. Instead the tool would extract the list of tests from the test suite and run those.
Example:
$ sfdx force:mdapi:deploy \
--testlevel RunTestSuite \
--runtests MyTestSuite \
--deploydir mypackage \
--wait -1 \
-u alan
# Maybe also supports multiple test suites:
$ sfdx force:mdapi:deploy \
--testlevel RunTestSuite \
--runtests MyTestSuite1,MyTestSuite2,MyTestSuiteN \
--deploydir mypackage \
--wait -1 \
-u alan
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:10 (3 by maintainers)
Top GitHub Comments
@dcarroll You can not use
--runtests
currently with a test suite name.Here is a bash script I wrote which kind of implements the feature, it requires xmlstartlet
In case it can help, there is an helper in the SFDX plugin of Accenture to extract all test classes from a test suite : https://github.com/Accenture/sfpowerkit#sfpowerkitsourceapextestsuiteconvert (sfpowerkit:source:apextestsuite:convert)