Ho 4 classi di test con una media di due funzioni di test ciascuna. Il primo test è sotto e deve essere corretto (è tratto dal tutorial di Play).Play Framework (2.1.3) non esegue alcun test
public class ApplicationTest {
@Test
public void simpleCheck() {
int a = 1 + 1;
assertThat(a).isEqualTo(2);
}
}
Gli altri sono realizzati su misura e hanno una configurazione @Before
, in questo modo:
public class UserTest extends WithApplication {
@Before
public void setUp() {
start(fakeApplication(inMemoryDatabase()));
}
// creation and retrieval of user
@Test
public void createAndRetrieveUser() {
new User("[email protected]", "Bob", "secret").save();
User bob = User.find.where().eq("email", "[email protected]").findUnique();
assertNotNull(bob); // successfully retrieved
assertEquals("Bob", bob.getName()); // correct user retrieved
}
}
Ora quando faccio funzionare play test
finisce molto più veloce e non esegue alcun test.
PS C:\wamp\www\dcid> play test
[info] Loading project definition from C:\wamp\www\dcid\project
[info] Set current project to dcid (in build file:/C:/wamp/www/dcid/)
[info] Compiling 4 Java sources to C:\wamp\www\dcid\target\scala-2.10\test-classes...
[info] ApplicationTest
[info]
[info]
[info] Total for test ApplicationTest
[info] Finished in 0.014 seconds
[info] 0 tests, 0 failures, 0 errors
[info] models.UserTest
[info]
[info]
[info] Total for test models.UserTest
[info] Finished in 0.002 seconds
[info] 0 tests, 0 failures, 0 errors
[info] models.ProposalTest
[info]
[info]
[info] Total for test models.ProposalTest
[info] Finished in 0.002 seconds
[info] 0 tests, 0 failures, 0 errors
[info] Passed: : Total 0, Failed 0, Errors 0, Passed 0, Skipped 0
[success] Total time: 5 s, completed 16/Ago/2013 14:52:35
Perché è questo? Cosa posso fare? Ho aggiornato di recente dal gioco 2.1.2 a 2.1.3. Ho aggiornato tutti i riferimenti e il progetto sta funzionando bene, tranne i test. Io anche looked at this question, ma non può essere quello, dal momento che non ho cambiato i miei test, quindi sono ben scritti, è solo la loro esecuzione che non funziona.
Si dovrebbe aggiungere tag java per consentire il formato a calciare in e hanno un po 'più di vista sulla sua domanda;) –
Nizza punta, io non lo sapevo, fatto;) – dialex