• dleonp@adcapital.cl
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Dear All:

 

I'm having a big problem when I try to test some triggers and schedulable jobs, because when I run the test, the code coverage doesn't change and remains in 0%, in spite of I run the same test in the IDE and the coverage is the needed to deploy. I've been several days on it, any help or suggestion would be appreciated.

 

The code of one of my triggers is:

 

trigger NuevoRespaldoTrigger on Respaldos__c (before insert, before update) {

Validaciones validacion = new Validaciones();
QueriesConciliacion queries = new QueriesConciliacion();
List<Movimiento__c> movimientos = queries.consultarMovimientosPorConciliar();
List<Respaldos__c> respaldos = queries.consultarRespaldosPorConciliar();
List<Movimiento__c> movimientosPreConciliados = new List<Movimiento__c>();
Map<Id, List<Attachment>> adjuntosEnRespaldosPorConciliar = queries.adjuntos(respaldos);
Preconciliacion preconciliacion = new Preconciliacion();
MetodosUniversales metodos = new MetodosUniversales();

for(Respaldos__c respaldo: Trigger.new){
Boolean asignado = false;
RespaldoWrapper respaldoW = new RespaldoWrapper(respaldo, adjuntosEnRespaldosPorConciliar.get(respaldo.Id));
if(Trigger.isUpdate && Trigger.oldMap.get(respaldo.Id).Pre_Conciliado__c == respaldo.Pre_Conciliado__c){
System.debug('#### ' + asignado + ' ' + respaldoW.respaldo.Id);
for(Movimiento__c movimiento: movimientos){
if(!metodos.EnLista(movimiento, movimientosPreConciliados)){
if(!asignado && (respaldoW.adjuntos != null && respaldoW.adjuntos.size()>0) && validacion.comparar(movimiento, respaldoW.respaldo)){
Movimiento__c movimientoPreConciliado = (Movimiento__c)preconciliacion.preconciliar(movimiento, respaldo, 'Movimiento');
movimientosPreConciliados.add(movimientoPreConciliado);
asignado = true;
}
}
}
}
}
update movimientosPreConciliados;
}

 

And the code for the test class is:

 

@isTest(SeeAllData=true)
public class NuevoMovimientoRespaldoTriggerTest {

static testMethod void myUnitTest() {
Respaldos__c rq = [SELECT Id, Monto_Final__c FROM Respaldos__c WHERE Monto_Final__c = 1];

rq.Monto_Final__c = 100;
update rq;

}

}

 

 

Best Regards,

 

Daniela.

Dear All:

 

I'm having a big problem when I try to test some triggers and schedulable jobs, because when I run the test, the code coverage doesn't change and remains in 0%, in spite of I run the same test in the IDE and the coverage is the needed to deploy. I've been several days on it, any help or suggestion would be appreciated.

 

The code of one of my triggers is:

 

trigger NuevoRespaldoTrigger on Respaldos__c (before insert, before update) {

Validaciones validacion = new Validaciones();
QueriesConciliacion queries = new QueriesConciliacion();
List<Movimiento__c> movimientos = queries.consultarMovimientosPorConciliar();
List<Respaldos__c> respaldos = queries.consultarRespaldosPorConciliar();
List<Movimiento__c> movimientosPreConciliados = new List<Movimiento__c>();
Map<Id, List<Attachment>> adjuntosEnRespaldosPorConciliar = queries.adjuntos(respaldos);
Preconciliacion preconciliacion = new Preconciliacion();
MetodosUniversales metodos = new MetodosUniversales();

for(Respaldos__c respaldo: Trigger.new){
Boolean asignado = false;
RespaldoWrapper respaldoW = new RespaldoWrapper(respaldo, adjuntosEnRespaldosPorConciliar.get(respaldo.Id));
if(Trigger.isUpdate && Trigger.oldMap.get(respaldo.Id).Pre_Conciliado__c == respaldo.Pre_Conciliado__c){
System.debug('#### ' + asignado + ' ' + respaldoW.respaldo.Id);
for(Movimiento__c movimiento: movimientos){
if(!metodos.EnLista(movimiento, movimientosPreConciliados)){
if(!asignado && (respaldoW.adjuntos != null && respaldoW.adjuntos.size()>0) && validacion.comparar(movimiento, respaldoW.respaldo)){
Movimiento__c movimientoPreConciliado = (Movimiento__c)preconciliacion.preconciliar(movimiento, respaldo, 'Movimiento');
movimientosPreConciliados.add(movimientoPreConciliado);
asignado = true;
}
}
}
}
}
update movimientosPreConciliados;
}

 

And the code for the test class is:

 

@isTest(SeeAllData=true)
public class NuevoMovimientoRespaldoTriggerTest {

static testMethod void myUnitTest() {
Respaldos__c rq = [SELECT Id, Monto_Final__c FROM Respaldos__c WHERE Monto_Final__c = 1];

rq.Monto_Final__c = 100;
update rq;

}

}

 

 

Best Regards,

 

Daniela.

Hello,

 

I have a visualforce page with a form I have created as a component.  Within the form component I have included a reference to another component which holds the commandButton.  There are 3 output panels within my form.  Within my component for the commandButton I have entered reRender="myStatus,FormFields,FormActions" . When I click on the button the page just refreshes with all panels redisplayed but this is incorrect as the form should have rerendered with different fields.

If I don't use a component for the commandButton and instead use the code for the commandButton in the form component the panels rerender ok.   is it possible that one component cannot rerender panels in a parent component?

 

Any help on this would be appreciated.   I tried to use a container panel as suggested in the following blog but this did not seem to work either.  http://bobbuzzard.blogspot.co.uk/2011/02/visualforce-re-rendering-woes.html

 

Maybe what I'm trying is not possible?

 

Thanks in advance!

I'm trying to integrate an external Web Service API into force.com. In that webservice I can get COntent of a File, my issue is how can I create a Visualforce page and APEX class such that I can get my force.com users to download the File. The file can be txt file, pdf file, excel file or anything. :( .... help ...

  • December 23, 2010
  • Like
  • 0