You need to sign in to do that
Don't have an account?

Test coverage
Hello all,
my first thread in the community forum...:smileyvery-happy:
I wrote a trigger in the sandbox environment and a test class that invokes that trigger.
the trigger works perfectly, and got 100% coverage.
the problem is that other triggers that were already in which I didn't wrote/change, didn't pass the tests.
those triggers were already in the environment, I didn't change a thing. I assumed that someone wrote test classes for them in order to deploy them to the production.
anyway, I understood that I need to write a test class that invokes the trigger I just wrote, which I did.
what am I missing here?
Thank a lot , Assaf


my first thread in the community forum...:smileyvery-happy:
I wrote a trigger in the sandbox environment and a test class that invokes that trigger.
the trigger works perfectly, and got 100% coverage.
the problem is that other triggers that were already in which I didn't wrote/change, didn't pass the tests.
those triggers were already in the environment, I didn't change a thing. I assumed that someone wrote test classes for them in order to deploy them to the production.
anyway, I understood that I need to write a test class that invokes the trigger I just wrote, which I did.
what am I missing here?
Thank a lot , Assaf


My initial thoughts is that you only ran the test methods for your individual trigger through the Eclipse IDE and for this reason all of the other code would have appeared to fail testing as the full suite of test classes would not have been run.
The easiest way to run all test classes is through the standard user interface. If you navigate to setup --> Develop --> Apex Classes and hit the 'Run All Tests' button I'm thinking your problems will go away.
Ok, from what I can gather from your post, I'm assuming that all these issues are in sandbox, and you haven't yet made an attemp to deploy the code to production. I mean, the existing tests are failing in sandobx, right? If this is the case, then try removing YOUR trigger and test code, and then try running the existing tests. If they still fail, that means you will have to fix the already written test code (that you did NOT write). There could be numerous reasons why the tests that had earlier passed, fail now. Here's a couple I can think of from the top of my head:
There could be others, but these are generally the two main reasons for such situations. Hope this helps!
I did run the test trough the GUI as you said and you were right.
I'm getting 88% code coverage vs 17%(!!!!!!) in eclipse.
why is that?
Am I going to have some troubles deploying it to the production through the eclipse?
Assaf
Eclipse will only pass a single file to the test API and therefore will not run all test classes within an instance. When you deploy to an environment the platform will run all test classes currently in that environment (unless it is being overwritten by a new file with the same name) and within the deployment payload you have created.