Hello everybody,

My results of jacoco code coverage and Unit tests are inconsistent.
In Sonar 4.0, on the dashboard, the Unit tests indicates that the method 
rattachementPlanifications_CG_CLD_PP
 of the class BRMSInterfaceImpl is covered through 100%:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/test-context.xml", 
"/META-INF/spring/rules-context.xml" })
public class TestPR03_QC799
    extends DiapasonTestBase
{
|
|
|
|
|
|
@Test
    public void step1()
    {

        TypePlanif typePlanif = typePlanifDAO.findByTypeSCA(0, null);

        Planification p1 = creerPlanificationwo(typePlanif);
        Planification p2 = creerPlanificationwo2(typePlanif);

        CrtPp crtPp1 = creerContratPermanentAvecMois();

        List<Contrat> contrats = new ArrayList<Contrat>();
        List<Planification> planifications = new ArrayList<Planification>();

        contrats.add(crtPp1);

        planifications.add(p1);
        planifications.add(p2);

        brmsInterface.rattachementPlanifications_CG_CLD_PP(contrats, 
planifications);

        // Vérifier
        checkContratGrilleAvecMoisAvecPlanifWO(crtPp1, p1);

    }
|
|
|
|
|
|
|
}




Whereas on SonarQube 4.0, the same method is marked as Not covered in the class 
BRMSInterfaceImpl

I thought that there was some problem with this class (BRMSInterfaceImpl) but 
in the same class BRMSInterfaceImpl, there is another method which is marked as 
covered on SonarQube 4.0 

And the Unit tests on SonarQube 4.0 for the method step1bis indicates a 
successful test



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/test-context.xml", 
"/META-INF/spring/rules-context.xml" })
public class TestPR06_QC518
    extends DBUnitSpringTestBase
{
|
|
|
|
|
|
|
@Test
    public void step1bis()
    {
        List<String> joinFetchPath = new ArrayList<String>();
        joinFetchPath.add("crtEtats");
        joinFetchPath.add("moises");
        joinFetchPath.add("moises.moiEtats");
        joinFetchPath.add("moises.evpsPrevisionnels");
        joinFetchPath.add("moises.evpsRealises");
        joinFetchPath.add("planifications");
        joinFetchPath.add("evpsForfait");
        joinFetchPath.add("evpsForfait.rubrique");
        joinFetchPath.add("societe");
        joinFetchPath.add("societe.effectifs");
        joinFetchPath.add("emploiConventionnel");
        joinFetchPath.add("emploiConventionnel.conventionCollective");
        joinFetchPath.add("emploiConventionnel.conventionCollective.histsChs");
        joinFetchPath.add("collaborateur");
        joinFetchPath.add("collaborateur.absences");
        CrtCld cld = CrtCldDAO.findById(145, joinFetchPath);

        Mois moisValo = null;
        for(Mois m : cld.getMoises())
        {
            if(m.getDateDebut().equals(new DateTime(2012, 04, 01, 0, 0, 0, 0)))
            {
                moisValo = m;
                break;
            }
        }

        // On crée les planifgs avec un RH approuvé
        cld.setPlanificationsAsList(creerPlanificationsAvril(cld, true));

        Assert.assertNotNull(moisValo);

        moisValo.setValoriserReal(true);

        brmsInterface.valoriserMoisCG_CLD(moisValo, cld, 0);

        HashMap<String, Double> expected = new HashMap<String, Double>();

|
|
|
|
|
|
|
}

Note that I use last version of Jacoco maven plugin and the report generated is 
really updated.
Does Spring is the cause of such inconsistency?
I didn’t find anything on the web, so I hope that someone will be able to help 
me

Thank you very much for you help

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to