You need to sign in to do that
Don't have an account?
Robert Zentgraf
Apex Unit Test for a trigger is not starting
Hi,
I created a trigger and wrote a test class on my DEV-environment.
Then I started the unit test. This test was not starting and not running. The system means, that I should wait, what I did, but nothing was happeing.
So, is there a bug or something else?
Regards
Robert
I found the solution, it's a bug: https://success.salesforce.com/issues_view?id=a1p300000008XgLAAU
Regards
Robert
(mindforce: http://www.mind-force.de)
All Answers
here the Trigger:
- trigger PhotoIdUpdate on Beraterprofil__c (before update, before insert) {
- for (Beraterprofil__c bp_ohne_PhotoId: Trigger.new){
- Folder[] fid = [SELECT Id FROM Folder WHERE Name='Beraterfotos' limit 1];
- Document[] bp = [SELECT Id FROM Document WHERE (folderid =: fid[0].Id AND AuthorID =: bp_ohne_PhotoId.OwnerID) limit 1];
- if(bp.size() > 0) {
- bp_ohne_PhotoId.Foto_ID__c = bp[0].ID;
- bp[0].IsPublic = true;
- update bp;
- }
- }
- }
and here the test-class:- @isTest
- private class PhotoIdUpdateTestClass{
- static testMethod void pruefePhotoIdUpdate(){
- Beraterprofil__c bp = new Beraterprofil__c(Berater__c='Robert');
- insert bp;
-
- bp.Berater__c='Robert_new';
- update bp;
-
- }
- }
RegardsRobert
Your code looks fine. Try to run your testclass through developer consol. You can view the percentage of code coverage there.
Thanks & Regards
Sagarika
the status of this test is queued. It won't be tested!?
Regards
Robert
I found the solution, it's a bug: https://success.salesforce.com/issues_view?id=a1p300000008XgLAAU
Regards
Robert
(mindforce: http://www.mind-force.de)