IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Eclipse Java Discussion :

[Junit] Problème "InitializationError"


Sujet :

Eclipse Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Septembre 2009
    Messages
    53
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 53
    Points : 37
    Points
    37
    Par défaut [Junit] Problème "InitializationError"
    Bonjour,

    Je rencontre un problème avec JUnit et Eclipse.

    J'ai bien ajouté au projet le plugin présent dans le dossier d'installation d'Eclipse.

    Quand je fait clique droit, New File j'ai bien JUnit Test Case.
    Je choisis les méthodes que je souhaite tester de ma classe ...

    Tout fonctionne bien mais quand j'exécute mes tests, j’obtiens très rapidement cette erreur :
    methode "initializationError" not found. Opening the test case
    Je ne comprend pas d'où cela peut provenir et je ne trouve rien sur internet ...
    Cela m’empêche de lancer n'importe quel test ...

    Merci d'avance !

    PS :Voici mes test simples :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    package fr.univavignon.m1informatique.rgla.isarchi;
    import static org.junit.Assert.*;
    import junit.framework.Assert;
     
    import org.junit.After;
    import org.junit.AfterClass;
    import org.junit.Before;
    import org.junit.BeforeClass;
    import org.junit.Test;
     
    /**
     * @author Sammy
     *
     */
    public class IsComponentTest {
     
        public static Boolean test;
     
        @BeforeClass
        public static void beforeClassTest()
        {
            test = true;
        }
     
        @AfterClass
        public static void AfterClassTest()
        {
            test = false;
        }
     
        /**
         * Test method for {@link fr.univavignon.m1informatique.rgla.isarchi.ISComponent#ISComponent(fr.univavignon.m1informatique.rgla.directory.DistinguishedName, fr.univavignon.m1informatique.rgla.isarchi.ISComponentType, java.lang.String)}.
         */
        @Test
        public void testISComponent() {
            Assert.assertTrue(true);
        }
     
        /**
         * Test method for {@link fr.univavignon.m1informatique.rgla.isarchi.ISComponent#getUnitName()}.
         */
        @Test
        public void testGetUnitName() {
            fail("Not yet implemented");
        }
     
        /**
         * Test method for {@link fr.univavignon.m1informatique.rgla.isarchi.ISComponent#getType()}.
         */
        @Test
        public void testGetType() {
            fail("Not yet implemented");
        }
     
        /**
         * Test method for {@link fr.univavignon.m1informatique.rgla.isarchi.ISComponent#getSimpleName()}.
         */
        @Test
        public void testGetSimpleName() {
            fail("Not yet implemented");
        }
    }

  2. #2
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2008
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2008
    Messages : 17
    Points : 10
    Points
    10
    Par défaut Problème avec JUnit !!
    Bonjour,

    J'ai exactement le même problème.

    Quelqu'un pourrait donner un coup de main? Parce que c'est la première fois que j'utilise JUnit.

    Voici le code des 3 classes: Je génère que la dernière FourOpCalculatorTest1

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    package fr.umlv.exposeJUnit.calculators;
     
    /*
     
    * Created on 28 oct. 2003 at 19:23:36 by Jerome
     
    *
     
    */
     
     
     
     
    /**
     
    * @author Jerome
     
    *
     
    */
     
    public class FourOpCalculator {
     
    	public int add(int a, int b)
     
    	{
     
    	return a + b;
     
    	}
     
    	public static int sub(int a, int b)
     
    	{
     
    	return a - b;
     
    	}
     
    	public int mul(int a, int b)
     
    	{
     
    	return a * b;
     
    	}
     
    	public int div(int a, int b)
     
    	{
     
    	return a / b;
     
    	}
     
    }



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    package fr.umlv.exposeJUnit.calculators;
     
    import junit.framework.TestCase;
     
    public class FourOpCalculatorTest extends TestCase{
     
     
     
     
    }



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    package fr.umlv.exposeJUnit.calculators;
     
    import static org.junit.Assert.*;
     
    import org.junit.Test;
     
    public class FourOpCalculatorTest1 {
    	int a = 5;
    	int b = 2;
    	@Test
    	public void testAdd() {
    		fail("Not yet implemented");
    	}
     
    	@Test
    	public void testSub() {
    		//fail("Not yet implemented");
    		int result = a - b;
     
    		assertEquals(result, FourOpCalculator.sub(a, b));
    	}
     
    	@Test
    	public void testMul() {
    		fail("Not yet implemented");
    	}
     
    	@Test
    	public void testDiv() {
    		fail("Not yet implemented");
    	}
     
    }


    Merci pour vos réponses.


    Aoitife

Discussions similaires

  1. Réponses: 15
    Dernier message: 21/02/2007, 17h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo