-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Ability to Run Specified Tests while comparing branches #140
Comments
Thanks for your interest on making this plugin better! This topic has already been discussed in another issue. You could reuse this approach and add a filter on the yq command to extract the apex class containing tests following your naming convention: I hope it helps |
Hi could you provide me an example of the the two command which I can add
to butbucket pipeline ?
…On Tue, May 25, 2021 at 3:52 AM Sebastien ***@***.***> wrote:
Hi @ravaliyerrabelly <https://github.com/ravaliyerrabelly>!
Thanks for your interest on making this plugin better!
This topic has already been discussed in another issue
<#126>.
We came up with a solution using yq
<https://github.com/scolladon/sfdx-git-delta#generate-a-comma-separated-list-of-the-added-and-modified-apex-classes>
to show all the apex class listed in the package.xml.
You could reuse this approach and add a filter on the yq command to
extract the apex class containing tests following your naming convention:
... select(.name=="ApexClass") | <filter members here> | .members |
join(",")'
I hope it helps
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#140 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALBBLJCXL26YGTGDPRYY53DTPNJMVANCNFSM45IGPM2A>
.
|
Yes of course:
|
We close this issue as this is covered in the README |
Can you please let me now the entire command which we have to use at the time for run : |
Hi @rpawar655 ! Not sure to understand what you want. |
Hi @scolladon , |
Okay, So, let's imagine we have this package.xml <?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Service</members>
<members>ServiceTest</members>
<name>ApexClass</name>
</types>
<version>55.0</version>
</Package> The file contains a $ xq . < output/package/package.xml | jq '.Package.types | [.] | flatten | map(select(.name=="ApexClass")) | .[] | .members | [.] | flatten | `map(select(. | index("*") | not)) | unique | map(select(. | index("Test"))) | join(",")'
> "ServiceTest" Then I use it in the command line directly (I use zsh, it may be different based on your shell): $ sfdx force:source:deploy --testlevel RunSpecifiedTests --runtests $(xq . < output/package/package.xml | jq '.Package.types | [.] | flatten | map(select(.name=="ApexClass")) | .[] | .members | [.] | flatten | map(select(. | index("*") | not)) | unique | map(select(. | index("Test"))) | join(",")') You may want to extract it in a variable before (it may be different based on your shell): $ SPECIFIED_TEST=$(xq . < output/package/package.xml | jq '.Package.types | [.] | flatten | map(select(.name=="ApexClass")) | .[] | .members | [.] | flatten | map(select(. | index("*") | not)) | unique | map(select(. | index("Test"))) | join(",")')
$ sfdx force:source:deploy --testlevel RunSpecifiedTests --runtests ${SPECIFIED_TEST} I hope it helps! |
Hey @scolladon That is what i am looking for thanks a ton 👍 |
Is your proposal related to a problem?
Currently when diff one branch to another, we need the ability to automatically recognize test classes which are added as part of the diff to package.xml.
Describe the solution you'd like
When doing a diff from feature branch to DEV branch, if we could recognize test classes which have been changed and just
run those test classes it will save a lot of time rather than running all test classes
The text was updated successfully, but these errors were encountered: