function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PuzzledPuzzled 

Ant deploy trying to test trigger that doesn't exist

Here's the output I'm getting from an ant deploy statement...
 
C:\1Salesforce Clients\Apex\eProsper>ant deploy
Buildfile: build.xml
deploy:
[sf:compileAndTest] compileAndTest on https://www.salesforce.com/services/Soap/u
/11.0, compiling 1 classes and 1 triggers, deleting 0 classes and 0 triggers
BUILD FAILED
C:\1Salesforce Clients\Apex\Client\build.xml:9: Failed:
Code coverage error on SetAStage: Test coverage of selected Apex Trigger is 0%
, at least 1% test coverage is required
Code coverage error: Test coverage of selected Apex Class and Trigger is 36%, at
 least 75% test coverage is required
 
The issue is that "SetAStage" is the name of a previous trigger I deployed and removed from the classes and triggers directories.  I have the correct trigger name in the build.xml and compileAndTest.apex files.
 
All I have in the directory I'm building from is build.xml and build.properties.  Under that are the classes (with only compileAndTest.apex in it) and triggers (with NewTriggerName.tgr) directories.
 
I've seen this happen when I left a previously deployed trigger in the triggers directory, even though I renamed its extension, so I don't leave previously deployed ones in there anymore.   I move them to a  totally different directory outside of the current build directory.  I even moved the build directory somewhere else, but it still found the name of the old trigger.  I looked for the old trigger name in each file and did a Windows search for that string and found nothing.
 
When I have errors in the trigger or test routine it does give me only the name of the current trigger I'm working on.
 
I've even rebooted in case it was stuck in memory or something but that didn't fix it.  Anyone have any ideas?
jgrenfelljgrenfell
It sounds like maybe "SetAStage" exists in Salesforce, even though you've removed it from your Ant directories.  You can go to the object it was a trigger for in Salesforce and see if it's listed there to confirm that.  If so, add a delete statement (<deleteTrigger>SetAStage</deleteTrigger> ) to your ant build to get rid of it.


Message Edited by jgrenfell on 02-11-2008 10:23 AM

Message Edited by jgrenfell on 02-11-2008 10:23 AM
PuzzledPuzzled
Yes, I wasn't very clear about that.  SetAStage does exist as a previously deployed trigger in Salesforce having nothing to do with the new one I'm trying to deploy.  They're not even triggers on the same object.  I was referring to the actual code of the previous trigger not existing in the development directory of the current one I'm trying to deploy.
 
Do I have to incorporate testing code for previously deployed triggers when trying to deploy a new one?  I haven't had to do that for the last couple of Apex deployments I've done.
jgrenfelljgrenfell
You need to have test methods for all the triggers that you have in production, but once you've deployed a test method that covers a trigger, you shouldn't have to deploy it again.  Is the class you're deploying now the same one that had previously covered the SetAStage trigger?  The only reason a new deployment should cause a code coverage issue with a trigger that's already deployed is if it removes/revises a test method needed to cover that trigger. 
PuzzledPuzzled

Thank you so much!

I had the same class name (compileAndTest), didn't know it got stored somewhere in Salesforce.  I'd like to know where.  I don't recall having to change it in previous multiple trigger deployments that I've done this way.

So I just changed the class name and it deployed.

jgrenfelljgrenfell
You're welcome!  You can see all the classes that have been deployed by going to Setup -> Code, or in Eclipse you have a read-only view of production; you just need to refresh the Class and Trigger folders to see anything new that's been deployed.
PuzzledPuzzled

I have a lot to learn.

Thanks again!