본문 바로가기

test

[Play Framework] Scala Test 1. Test 폴더에 Scala 테스트 클래스를 작성한다. 2. 관련 라이브러리 importimport play.api.test._ import play.api.test.Helpers._ 3. Application 상황에서 테스트를 하고 싶다면val fakeApplicationWithGlobal = FakeApplication(withGlobal = Some(new GlobalSettings() { override def onStart(app: Application) { println("Hello world!") } })) 4. 테스트 Object 작성object ExamplePlaySpecificationSpec extends PlaySpecification { "The specification" sh.. 더보기
Maven install시 Test Skip 하기 아주 간단하다~! pom.xml에 입력해주면 끝~! org.apache.maven.plugins maven-surefire-plugin 2.12.4 true 더보기
[Play Framework] No EntityManager bound to this thread. Try wrapping this call in JPA.withTransaction, or ensure that the HTTP context is setup on this thread. 테스트를 하다가 JPA관련 테스트를 진행하면 다음과 같은 에러가 발생한다....이유는 Transaction과 관련이 있었다. 현재 테스트 하는 Thread가 binding?이 되지 못해서 생기는 오류인듯 하다. 해결방법은 간단하다. [error] Test ServiceTest.deviceServiceTest failed: java.lang.RuntimeException: No EntityManager bound to this thread. Try wrapping this call in JPA.withTransaction, or ensure that the HTTP context is setup on this thread.[error] at play.db.jpa.JPA.em(JPA.java:55)[erro.. 더보기
[Play Framework] Test 하기~! 아직 TTD에 대해 많이 알진 못하지만 주위에 주워들은 이야기로는.. TTD가 오히려 빠른 개발을 할수있다~! 뭐 이런씩의 이야기와 Test가 필요해져서..PlayFramework의 Test 방법을 살펴보았다. 엄청 간단하다~! Test 클래스를 생성한뒤~! Test하고 싶은 함수에 @Test를 붙인다. 그리고 test라고 입력만 하면 알아서 Test를 한다.~! 더보기