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
Robert ZentgrafRobert 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

Best Answer chosen by Robert Zentgraf
Robert ZentgrafRobert Zentgraf
Hi @all,

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

Shaijan ThomasShaijan Thomas
Please share your trigger and test class code here
Robert ZentgrafRobert Zentgraf
Hi Shaljan,

here the Trigger:
  1. trigger PhotoIdUpdate on Beraterprofil__c (before update, before insert) {
  2.     for (Beraterprofil__c bp_ohne_PhotoId: Trigger.new){
  3.         Folder[] fid = [SELECT Id FROM Folder WHERE Name='Beraterfotos' limit 1];
  4.         Document[] bp = [SELECT Id FROM Document WHERE (folderid =: fid[0].Id AND AuthorID =: bp_ohne_PhotoId.OwnerID) limit 1];
  5.         if(bp.size() > 0) {
  6.             bp_ohne_PhotoId.Foto_ID__c = bp[0].ID;
  7.             bp[0].IsPublic = true;
  8.             update bp;
  9.         }
  10.     }
  11. }
and here the test-class:
  1. @isTest
  2. private class PhotoIdUpdateTestClass{
  3.     static testMethod void pruefePhotoIdUpdate(){
  4.         Beraterprofil__c bp = new Beraterprofil__c(Berater__c='Robert');
  5.         insert bp;
  6.         
  7.         bp.Berater__c='Robert_new';
  8.         update bp;
  9.         
  10.     }
  11. }
Regards
Robert
Sagarika RoutSagarika Rout
Hi Robert ,

Your code looks fine. Try to run your testclass through developer consol. You can view the percentage of code coverage there.

Thanks & Regards
Sagarika
Robert ZentgrafRobert Zentgraf
Hi Sagarika,

the status of this test is queued. It won't be tested!?

Regards
Robert
Robert ZentgrafRobert Zentgraf
Hi @all,

I found the solution, it's a bug: https://success.salesforce.com/issues_view?id=a1p300000008XgLAAU

Regards
Robert
(mindforce: http://www.mind-force.de)
This was selected as the best answer