webmvctest 시 질문

미해결질문
이원준 프로필

    samplecontrollertest.java에 아래의 소스를 넣었을때

mockMvc.perform(get("/hello")) // get 으로 /hello 요청하면

.andExpect(status().isOk()) // status 는 200 이고

.andExpect(content().string("hello ironman")) // content 는 hello ironman 이고

.andDo(print()); // 해당 사항들을 print로 출력함

print로 출력이 run시킬때 run log창에 남는건가요?

저는 그냥 아래와 같이 뜨기만하고 print로 찍히는게 안보입니다.

2019-04-01 23:33:34.944 INFO 8148 --- [ main] m.i.s.SpringtestdemoApplication : Starting SpringtestdemoApplication on DESKTOP-2849P80 with PID 8148 (C:\SpringWork\IntelliJ\springtestdemo\target\classes started by nari1 in C:\SpringWork\IntelliJ\springtestdemo)

2019-04-01 23:33:34.944 INFO 8148 --- [ main] m.i.s.SpringtestdemoApplication : No active profile set, falling back to default profiles: default

2019-04-01 23:33:35.870 INFO 8148 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

2019-04-01 23:33:35.890 INFO 8148 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2019-04-01 23:33:35.890 INFO 8148 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]

2019-04-01 23:33:35.900 INFO 8148 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:Program FilesJavajdk1.8.0_201bin;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;C:Program Files (x86)Common FilesOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;C:Program FilesJavajdk1.8.0_201bin;C:Usersnari1AppDataLocalMicrosoftWindowsApps;;C:Program Files (x86)ESTsoftALSeex64;.]

2019-04-01 23:33:35.989 INFO 8148 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2019-04-01 23:33:35.989 INFO 8148 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 998 ms

2019-04-01 23:33:36.157 INFO 8148 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'

2019-04-01 23:33:36.473 INFO 8148 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''

2019-04-01 23:33:36.473 INFO 8148 --- [ main] m.i.s.SpringtestdemoApplication : Started SpringtestdemoApplication in 1.814 seconds (JVM running for 2.41)

백기선 프로필
백기선 8달 전

로그를 보니까 테스트를 실행한게 아니라 애플리케이션을 실행하신거 같습니다. 맨 마지막 줄 보이시죠?

지식공유자 되기
많은 사람들에게 배움의 기회를 주고,
경제적 보상을 받아보세요.
지식공유참여
기업 교육을 위한 인프런
“인프런 비즈니스” 를 통해 모든 팀원이 인프런의 강의들을
자유롭게 학습하는 환경을 제공하세요.
인프런 비즈니스