android JUnit Tests pas en cours d'exécution
Le problème n'est pas que les tests échouent, mais qu'ils n'ont tout simplement pas fonctionner.
C'est-à-dire, la console me dit qu'ils exécutent, mais je ne vois absolument pas de résultats à tous.
Noter que j'ai "avoir" rappelé à annoter les méthodes avec @Test
Voici le code pour la classe de test:
package module.jakway.JournalEntry.test;
import module.jakway.JournalEntry.Module_JournalEntry;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class MainTest extends android.test.ActivityInstrumentationTestCase2<Module_JournalEntry>
{
public MainTest(Class activityClass) {
super("module.jakway.JournalEntry", Module_JournalEntry.class);
//TODO Auto-generated constructor stub
}
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
super.setUp();
Module_JournalEntry journalentry = getActivity();
assertTrue(true);
}
@After
public void tearDown() throws Exception {
}
@Test
public void myTestCase()
{
assertTrue(false);
}
}
Le projet que je suis en essais est nommé Module_JournalEntry avec le paquet module.jakway.JournalEntry et de l'Activité Module_JournalEntry.java
Voici la sortie de la console:
[2011-02-04 20:37:10 - Module_JournalEntryTest] Performing android.test.InstrumentationTestRunner JUnit launch
[2011-02-04 20:37:10 - Module_JournalEntryTest] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'my2.3Emulator'
[2011-02-04 20:37:12 - Module_JournalEntryTest] Application already deployed. No need to reinstall.
[2011-02-04 20:37:12 - Module_JournalEntryTest] Project dependency found, installing: Module_JournalEntry
[2011-02-04 20:37:14 - Module_JournalEntry] Application already deployed. No need to reinstall.
[2011-02-04 20:37:14 - Module_JournalEntryTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2011-02-04 20:37:14 - Module_JournalEntryTest] Collecting test information
[2011-02-04 20:37:17 - Module_JournalEntryTest] Sending test information to Eclipse
[2011-02-04 20:37:17 - Module_JournalEntryTest] Running tests...
[2011-02-04 20:37:19 - Module_JournalEntryTest] Test run finished
et le logcat de sortie:
02-04 20:37:10.266: DEBUG/AndroidRuntime(524): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 20:37:10.266: DEBUG/AndroidRuntime(524): CheckJNI is ON
02-04 20:37:11.236: DEBUG/AndroidRuntime(524): Calling main entry com.android.commands.pm.Pm
02-04 20:37:11.316: DEBUG/AndroidRuntime(524): Shutting down VM
02-04 20:37:11.336: INFO/AndroidRuntime(524): NOTE: attach of thread 'Binder Thread #3' failed
02-04 20:37:11.346: DEBUG/dalvikvm(524): GC_CONCURRENT freed 102K, 71% free 297K/1024K, external 0K/0K, paused 3ms+8ms
02-04 20:37:11.346: DEBUG/jdwp(524): Got wake-up signal, bailing out of select
02-04 20:37:11.346: DEBUG/dalvikvm(524): Debugger has detached; object registry had 1 entries
02-04 20:37:12.316: DEBUG/AndroidRuntime(534): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 20:37:12.316: DEBUG/AndroidRuntime(534): CheckJNI is ON
02-04 20:37:13.136: DEBUG/AndroidRuntime(534): Calling main entry com.android.commands.pm.Pm
02-04 20:37:13.186: DEBUG/AndroidRuntime(534): Shutting down VM
02-04 20:37:13.216: INFO/AndroidRuntime(534): NOTE: attach of thread 'Binder Thread #3' failed
02-04 20:37:13.216: DEBUG/dalvikvm(534): GC_CONCURRENT freed 102K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
02-04 20:37:13.216: DEBUG/dalvikvm(534): Debugger has detached; object registry had 1 entries
02-04 20:37:14.256: DEBUG/AndroidRuntime(544): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 20:37:14.256: DEBUG/AndroidRuntime(544): CheckJNI is ON
02-04 20:37:15.126: DEBUG/AndroidRuntime(544): Calling main entry com.android.commands.am.Am
02-04 20:37:15.176: INFO/ActivityManager(75): Force stopping package module.jakway.JournalEntry uid=10035
02-04 20:37:15.206: INFO/ActivityManager(75): Start proc module.jakway.JournalEntry for added application module.jakway.JournalEntry: pid=552 uid=10035 gids={1015}
02-04 20:37:15.876: WARN/TestGrouping(552): Invalid Package: '' could not be found or has no tests
02-04 20:37:15.976: INFO/ActivityManager(75): Force stopping package module.jakway.JournalEntry uid=10035
02-04 20:37:15.976: INFO/Process(75): Sending signal. PID: 552 SIG: 9
02-04 20:37:15.986: DEBUG/AndroidRuntime(544): Shutting down VM
02-04 20:37:16.016: DEBUG/dalvikvm(544): GC_CONCURRENT freed 103K, 71% free 299K/1024K, external 0K/0K, paused 1ms+4ms
02-04 20:37:16.036: INFO/AndroidRuntime(544): NOTE: attach of thread 'Binder Thread #3' failed
02-04 20:37:16.046: DEBUG/jdwp(544): Got wake-up signal, bailing out of select
02-04 20:37:16.046: DEBUG/dalvikvm(544): Debugger has detached; object registry had 1 entries
02-04 20:37:16.656: DEBUG/AndroidRuntime(563): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 20:37:16.665: DEBUG/AndroidRuntime(563): CheckJNI is ON
02-04 20:37:17.646: DEBUG/AndroidRuntime(563): Calling main entry com.android.commands.am.Am
02-04 20:37:17.716: INFO/ActivityManager(75): Force stopping package module.jakway.JournalEntry uid=10035
02-04 20:37:17.746: INFO/ActivityManager(75): Start proc module.jakway.JournalEntry for added application module.jakway.JournalEntry: pid=572 uid=10035 gids={1015}
02-04 20:37:18.606: WARN/TestGrouping(572): Invalid Package: '' could not be found or has no tests
02-04 20:37:18.826: INFO/ActivityManager(75): Force stopping package module.jakway.JournalEntry uid=10035
02-04 20:37:18.826: INFO/Process(75): Sending signal. PID: 572 SIG: 9
02-04 20:37:18.846: DEBUG/AndroidRuntime(563): Shutting down VM
02-04 20:37:18.906: INFO/AndroidRuntime(563): NOTE: attach of thread 'Binder Thread #4' failed
02-04 20:37:18.916: DEBUG/dalvikvm(563): GC_CONCURRENT freed 103K, 71% free 298K/1024K, external 0K/0K, paused 2ms+28ms
02-04 20:37:18.916: DEBUG/jdwp(563): Got wake-up signal, bailing out of select
02-04 20:37:18.926: DEBUG/dalvikvm(563): Debugger has detached; object registry had 1 entries
Merci beaucoup!
OriginalL'auteur Prime | 2011-02-05
Vous devez vous connecter pour publier un commentaire.
Android bases de son framework de test sur JUnit 3 qui permet de ne pas utiliser les annotations, mais la réflexion et de la méthode d'essai noms devraient inclure la test préfixe.
Déplacer à JUnit 3 et de l'exécution des tests à partir d'Eclipse comme
Run As -> Android JUnit Test
ou à l'aide deam instrument
en ligne de commande.OriginalL'auteur Diego Torres Milano
Essayez de changer ce:
:
Le constructeur devrait avoir aucun paramètre dans ce cas. C'est écrit dans le Bonjour, Les Tests exemple de tutoriel en vertu de la Ajoutant le cas de test constructeur section.
OriginalL'auteur Stan Sidel
"Le Android test de l'API prend en charge JUnit 3 du code de style, mais pas JUnit 4" - http://developer.android.com/tools/testing/testing_android.html
1.Mise à jour de votre test à suivre JUnit 3 normes
2.Supprimer tout JUnit 4 références dans le projet de test (cliquez droit sur le projet -> propriétés -> java build path -> Bibliothèques (onglet)
OriginalL'auteur Steven Mark Ford