collègues, j'ai annotation @ignore dans ma classe de test AppTest.java.
Pourquoi l'annotation @Ignore ne fonctionne pas?
import java.math.BigInteger;
import java.util.UUID;
import org.fluttercode.datafactory.impl.DataFactory;
import org.junit.Ignore;
import org.junit.Test;
import junit.framework.TestCase;
public class AdapterAppTest extends TestCase {
@Ignore("this test is not ready yet")
public static void testCreateApplicationWithAllRequiredParameters() {
AdapterApp.setWsURL(URL);
AdapterApp adapterApp = new AdapterApp();
System.out.println("Set UP Request Parameters");
DataFactory df = new DataFactory();
adapterApp.setRequestTimestamp("2015-12-01T12:12:12.123"));
adapterApp.setRequestUid(UUID.randomUUID().toString());
adapterApp.setProductType("0");
String applicationNum = adapterApp.createApplication();
assertEquals("2 symb", 2, applicationNum.length());
}
}
Mon pom ressemble:
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>io.codearte.jfairy</groupId>
<artifactId>jfairy</artifactId>
<version>0.5.1</version>
</dependency>
<dependency>
<groupId>org.fluttercode.datafactory</groupId>
<artifactId>datafactory</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>AdapterAppTest.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>com.adapter</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.adapter</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.adapter_entities</generatePackage>
<schemas>
<schema>
<url>src/main/resources/Import.wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
</plugins>
En conséquence, je reçois:
[INFO] Recherche de projets ... [INFO] [INFO] --------------- -------------------------------------------------- ------- [INFO] Adaptateur de bâtiment 0.0.1-SNAPSHOT [INFO] ---------------------------- -------------------------------------------- [INFO] [ INFO] --- maven-jaxb2-plugin: 0.13.0: génère (par défaut) @ adaptateur --- [INFO] Contrôle à jour pour les ressources source [INFO] [INFO] --- maven-resources-plugin: 2.6: ressources (ressources par défaut) @ adaptateur --- [INFO] Utilisation de l'encodage 'UTF-8' pour copier les ressources filtrées. [INFO] Copie 3 ressources [INFO] Copie 1 ressource [INFO] [INFO] --- maven-compiler-plugin: 3.3: compilation (compilation par défaut) @ adaptateur --- [INFO] Modifications détectées - recompiler le module! [INFO] Compilation de 25 fichiers sources vers C: \ Users \ git \ adaptateur \ adaptateur \ target \ classes [INFO] [INFO] --- maven-resources-plugin: 2.6: testResources (default-testResources) @ adaptateur --- [INFO] Utilisation de l'encodage 'UTF-8' pour copier les ressources filtrées. [INFO] ignorer resourceDirectory non existant C: \ Users \ git \ adaptateur \ src \ test \ ressources [INFO] [INFO] --- maven-compilateur-plugin: 3.3: testCompile (default-testCompile) @ adaptateur --- [INFO] Rien à compiler - toutes les classes sont à jour [INFO] [INFO] --- maven-surefire-plugin: 2.19: test (test par défaut) @ adaptateur ---
Pourquoi l'annotation @Ignore n'a-t-elle aucun effet?------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.adapter.AdapterAppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.546 sec - in com.adapter.AdapterAppTest Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-surefire-plugin:2.19:test (default) @ adapter --- [INFO] Skipping execution of surefire because it has already been run for this configuration [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.452 s [INFO] Finished at: 2015-12-03T16:09:13+03:00 [INFO] Final Memory: 25M/413M [INFO] ------------------------------------------------------------------------
Pourquoi l'annotation @Ignore n'a-t-elle aucun effet?
Utilisez-vous **@org.junit.Ignore**? – Raf
Oui, 'org.junit.Ignore'. Désolé pour le formatage, j'essaie de réparer. – May12
Il est difficile de commenter sans le vrai code qui pose problème. Je vous recommande de mettre à jour votre question pour inclure votre classe de test avec la méthode de test qui doit être ignorée ainsi que les ** importations **, il sera plus facile de repérer les erreurs. Gardez à l'esprit que vous pouvez également passer des tests en utilisant maven-surefire-plugin config mais, vous voulez que @Ignore fonctionne si bien, alors montrez-nous plus de code – Raf