0

I'm trying to run ant command - deploy and deployCodeCheckOnly - on my sandbox org. In both targets, testLevel attribute value is RunSpecifiedTests and RunLocalTests.

Commands executed successfully and code deployed/validated on the sandbox org without executing the test methods.

Could anyone please help me in order to resolve this issue fast?

  • Did you mention the test class names which needs to be run in xml file ? – Vijay Ganji May 20 at 9:51
  • Yes, I've added test class names when I executed RunSpecifiedTests command. – Anurag Bhardwaj May 20 at 10:16
0

You will have to mention the test class names in build.xml file which you want to run.

Your build.xml file should have the test class names like below, you can replace the name of the target and test class names that matches your requirement.

<target name="deployCode">
    <sf:deploy username="${sf.username}" password="${sf.password}" 
           sessionId="${sf.sessionId}" serverurl="${sf.serverurl}"
           deployroot="codepkg" testLevel="RunSpecifiedTests">
        <runTest>TestClass1</runTest>
        <runTest>TestClass2</runTest>
        <runTest>TestClass3</runTest>
    </sf:deploy>
</target>
<target name="deployCodeCheckOnly">
    <sf:deploy username="${sf.username}" password="${sf.password}" 
           sessionId="${sf.sessionId}" serverurl="${sf.serverurl}"
           deployroot="codepkg" testLevel="RunSpecifiedTests" checkOnly="true">
        <runTest>TestClass1</runTest>
        <runTest>TestClass2</runTest>
        <runTest>TestClass3</runTest>
    </sf:deploy>
</target>

You can refer this salesforce document for further help on this topic.

  • Hello Vijay, I've tried this option but it has not worked for me. – Anurag Bhardwaj May 20 at 10:33
  • Can you edit your question to include the build.xml file's content as well. – Vijay Ganji May 20 at 10:38
  • @AnuragBhardwaj Is this how your build.xml file's content look like ? – Vijay Ganji May 21 at 8:37
  • Hi @VijayGanji, Yes it looks like the same. I've opened a case with Salesforce and it seems they can fix this issue internally. I'll update once I receive any update. – Anurag Bhardwaj May 21 at 17:08
  • Hi @VijayGanji, Yes we need to contact with Salesforce in order to enable this feature. This is something which they manage internally. My problem is now resolved. – Anurag Bhardwaj May 22 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.