Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
NatureGod

Although both Triggers got 100% coverage in the dev ,in the prod it wil not validate

Greetings,

Although both Triggers got 100% coverage in the dev,, funny enough, in the prod it wil not validate since it requires as it says 100% coverage!!!

Trigger 1:

trigger CalculateTotalAmount on Consumer__c (before update)
{

Integer i = 0;

Consumer__c parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of opportunities who are children of this parent opportunity record.
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: intTest];

Double j = 0;
Double jj = 0;

// Loop through the filtered Consumers and sum up their amounts.
for(Solution op : opp)
{
If
(
op.Points__c != Null
)

{
j += op.Points__c ;
jj += op.Points__c ;

}
}
parObj.Parallel_Points__c = j;
// parObj.Points__c = jj;

}

Trigger 2:

trigger CalculateTotalAmountAccount on Account (before update)
{

Integer i = 0;

Account parObj = Trigger.new[i];

// Current parent opportunity ID
String intTest = Trigger.new[i].Id;

//Step 2. Create a list of Consumer__c who are children of this parent opportunity record.
List<Consumer__c> opp = [Select Consumer__c.Id, Consumer__c.Basket__c From Consumer__c where Consumer__c.Ophelia__c =: intTest];

Double j = 0;

// Loop through the filtered Consumers and sum up their amounts.
for(Consumer__c op : opp)
{
If
(
)

{
}
}

Test Class:

@istest
public class TesttrgOnArticulo{
Private Static testmethod void TesttrgOnArticulo(){
//Insert Participacion__c Record
Consumer__c Con = new Consumer__c ();
Con.Mobile__c = '1234';
Test.startTest();
insert Con;

//Insert Articulo__c Record
for(Integer i = 0; i < 50; i++){
Solution Sol = new Solution();
Sol.SolutionName = 'Test';
Sol.Status= 'Reviewed';
Sol.PointConvertion__c = 'Προσθήκη Πόντων';
Sol.Total_Amount__c = 100;
Sol.PointConvertion__c = '10';
Sol.Consumer__c = Con.id;
Sol.Points__c = 0;
Sol.Points__c = Sol.Points__c +1;
insert Sol;
update Sol;
}

Con.Mobile__c = '5678';
update Con;

//Insert Participacion__c Record
Account Acc = new Account();
Acc.Name= 'TEST';
insert Acc ;

Con.Ophelia__c = Acc.id;
update Con;

Acc.Name= 'TEST Update';
update Acc;

Test.stopTest();
List<Solution> opp = [Select Solution.Id, Solution.Points__c From Solution where Solution.Consumer__c =: Con.id];
}
}

Any suggestions?

Stefanos