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
Madhusudhan Reddy 11Madhusudhan Reddy 11 

Task Trigger deployment issues

When deploying task trigger it shows Triggers have 0% code coverage

but the same if we deploy through change set and runts the test class it covers 100% any advise on this please suggect 

here is trigger and test class 

trigger TaskTrigger on Task(before insert) {
    TaskTriggerHandler handler = new TaskTriggerHandler(Trigger.isExecuting, Trigger.size);
        if (trigger.isbefore&& trigger.isinsert) {
test class 

@isTest(SeeAllData = false)
Public class taskTriggerHandlertest{
static testmethod void addTTControllerTest()  {
    //insert new ACNTriggerSettings__c(SetupOwnerId=UserInfo.getUserid(), LG_TaskTrigger__C=false);
    Account testAccount = new Account(Name='testAccountM',BillingStreet='TestStreet', BillingCity='Test City', BillingState='State', BillingPostalCode='12345', BillingCountry='UK');
    insert testAccount;
    system.assertEquals('testAccountM', testAccount.Name);

    Contact testContact = new Contact(FirstName = 'TestNameM', LastName = 'TestNameM', Salutation ='Mr.', email = '',;
    insert testContact;
    system.assertEquals('TestNameM', testContact.FirstName);

    Opportunity testOpportunity = new Opportunity(amount=500,CloseDate =,Approval_Stage4_5__c='Not Submitted', Name = 'TestOppM', StageName = 'Quoting', AccountId );
    insert testOpportunity;
    system.assertEquals('TestOppM', testOpportunity.Name);
    CSCAP__Customer_Approval__c TestCustomerapproval = new CSCAP__Customer_Approval__c(;
    insert TestCustomerapproval ;
    task Testtask = new task (Subject='Customer Approval Received',Status='In Progress',Priority='Medium',type='Other',,OwnerId = UserInfo.getUserid());
    insert Testtask ;


How are you deploying TASK trigger and where (sandbox or Production)?You mentioned that using changeset it does not show any error.So, Is there any issue with use of changeset?
Madhusudhan Reddy 11Madhusudhan Reddy 11
Hi Abhisheck
we are deploying to full copy sandbox using bamboo build 
change set also if we run the test class while deploying it fails but if we deploywithout test execution it deploy and latter if we execute test class in it shows full coverage only during deployment test runts its not pulling the coverage 
In your build can you include the test class too and force this test class to run? you may add something like below


Please take a look here (
Madhusudhan Reddy 11Madhusudhan Reddy 11
Hi Abhishek, Thanks Let me try this option aswell
Thanks, please let me know the outcome
Madhusudhan Reddy 11Madhusudhan Reddy 11
Hi Abhishek,

i have included task insertion in some other test class and it worked really appreciate your quick response thankyou