Maven führt keine Spring -Boot -Tests ausJava

Java-Forum
Anonymous
 Maven führt keine Spring -Boot -Tests aus

Post by Anonymous »

Ich habe eine Rast Spring -Start -REST -API, die ich testen möchte. Ich kann die Tests manuell in Eclipse ausführen (ohne Maven und durch Ausführen der Anwendung als JUNIT -Test) und es wird gut ausgeführt und die Ergebnisse angezeigt, aber MVN -Test < /code> "funktionieren" nicht "funktionieren", wie Sie unten herausfinden werden. />http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

org.demo
rest
0.0.1-SNAPSHOT
war

UserRegistrationServices
RESTful API


org.springframework.boot
spring-boot-starter-parent
1.2.5.RELEASE




UTF-8
1.8






junit
junit
test




org.springframework.boot
spring-boot-starter-data-mongodb


org.springframework.boot
spring-boot-starter-web


org.springframework.boot
spring-boot-starter-security




org.springframework.boot
spring-boot-starter-tomcat
provided




org.springframework.boot
spring-boot-starter-test
test


com.jayway.restassured
rest-assured
2.4.1
test


com.jayway.restassured
json-schema-validator
2.4.1
test




com.fasterxml.jackson.core
jackson-core
2.5.4


com.fasterxml
jackson-xml-databind
0.6.2




commons-codec
commons-codec
1.10





spring-snapshots
http://repo.spring.io/snapshot






org.springframework.boot
spring-boot-maven-plugin



repackage






< /code>

< /p>

Dies ist das Ergebnis des MVN -Tests < /code>: < /p>

[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UserRegistrationServices 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rest ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to C:\Users\pmandayam\git\UserRegistrationServices\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\pmandayam\git\UserRegistrationServices\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rest ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\pmandayam\git\UserRegistrationServices\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ rest ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.768 s
[INFO] Finished at: 2015-07-28T12:07:41-05:00
[INFO] Final Memory: 24M/212M
[INFO] ------------------------------------------------------------------------
< /code>

Hier ist ein Segment meiner testcontroller.java -Klasse in Src /test /java: < /p>

@Test
public void f_findByUsername() {
// Finding user with username 'user1username'

given().auth().basic("User1username", "Testpassword").when().get(
"http://localhost:8080/users/get/ByUsern ... r1username")
.then().assertThat().body("username", is("User1username"));
}
< /code>

oben in der TestController -Klasse Ich habe folgende Anmerkungen: < /p>

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
/* Tells the embedded Tomcat server to start on a random, open port */
@IntegrationTest("server.port:0")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestController {....}
< /code>

Ich bin mir nicht sicher, was los ist. Ich habe kein todes Plugin, aber es sucht danach, wie es scheint.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post