[Seasar-user:5686] Re: [Teeda] Actionクラスのunitテストについて

Mitsutaka Sato [E-MAIL ADDRESS DELETED]
2007年 1月 9日 (火) 05:54:40 JST


佐藤です。

ひがさん、大谷さん、ありがとうございました。
なるほど、TeedaTestCaseというのがあるんですね。
失礼しました。

On 1/5/07, Shinpei Ohtani <[E-MAIL ADDRESS DELETED]> wrote:
>
> 大谷です。
>
> > TeedaのActionクラスをunitテストする方法論というかドキュメントはどこかにございますでしょうか?
> >  テスト用のdiconファイルを作って、facesContextのMockを登録して、、、みたいな感じに
> > する必要があるのでしょうか?
>
> S2TestCaseでなく、TeedaTestCaseを使用してください。
> ただActionのUTなのに、Interceptorが動いてしまっているのも変なので、
> customizer.diconをUT用のもの(customizer_utmock.diconなど)を作り、
> env.txtをutにあわせてテストを行うと良いと思います。
>
>
> 07/01/05 に Mitsutaka Sato<[E-MAIL ADDRESS DELETED]> さんは書きました:
> > 佐藤と申します。
> > 引き続きTeedaに関しての質問です。
> >
> > S2TestCaseを継承したテストクラスで実行してみたところ、
> >
> > org.seasar.teeda.extension.interceptor.ActionSupportInterceptor.savePage
> (ActionSupportInterceptor.java:82)
> > でnullpoが発生するようです。
> >
> > 発生箇所は、
> >  ExternalContext externalContext = facesContext.getExternalContext();
> > で、facesContextがnullのため、、ということのようです。
> >
> > TeedaのActionクラスをunitテストする方法論というかドキュメントはどこかにございますでしょうか?
> >  テスト用のdiconファイルを作って、facesContextのMockを登録して、、、みたいな感じに
> > する必要があるのでしょうか?
> >
> > 以下スタックトレースです。(teeda 1.0.2)
> > ===================================
> > java.lang.NullPointerException
> >     at
> > org.seasar.teeda.extension.interceptor.ActionSupportInterceptor.savePage
> > (ActionSupportInterceptor.java:82)
> >     at
> > org.seasar.teeda.extension.interceptor.ActionSupportInterceptor.invoke(
> ActionSupportInterceptor.java:73)
> >     at
> >
> honesty.imapweb3.web.regist.ConfirmAction$$EnhancedByS2AOP$$4bf53e$$MethodInvocation$$doRegist0.proceed
> > (MethodInvocationClassGenerator.java)
> >     at
> > org.seasar.framework.aop.interceptors.TraceInterceptor.invoke(
> TraceInterceptor.java:59)
> >     at
> >
> honesty.imapweb3.web.regist.ConfirmAction$$EnhancedByS2AOP$$4bf53e$$MethodInvocation$$doRegist0.proceed
> > (MethodInvocationClassGenerator.java)
> >     at
> >
> honesty.imapweb3.web.regist.ConfirmAction$$EnhancedByS2AOP$$4bf53e.doRegist
> (ConfirmAction$$EnhancedByS2AOP$$4bf53e.java)
> >     at
> > honesty.imapweb3.web.regist.ConfirmActionTest.test正常系
> > (ConfirmActionTest.java:67)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> > Source)
> >     at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > (Unknown Source)
> >     at java.lang.reflect.Method.invoke(Unknown Source)
> >     at junit.framework.TestCase.runTest(TestCase.java:164)
> >     at
> > org.seasar.framework.unit.S2FrameworkTestCase.doRunTest(
> S2FrameworkTestCase.java
> > :294)
> >     at
> > org.seasar.extension.unit.S2TestCase.doRunTest(S2TestCase.java:92)
> >     at
> > org.seasar.framework.unit.S2FrameworkTestCase.runBare(
> S2FrameworkTestCase.java:190)
> >     at junit.framework.TestResult$1.protect
> > (TestResult.java:106)
> >     at
> > junit.framework.TestResult.runProtected(TestResult.java:124)
> >     at junit.framework.TestResult.run(TestResult.java:109)
> >     at junit.framework.TestCase.run(TestCase.java:120)
> >     at
> > junit.framework.TestSuite.runTest(TestSuite.java:230)
> >     at junit.framework.TestSuite.run(TestSuite.java:225)
> >     at
> > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(
> JUnit3TestReference.java:128)
> >     at
> > org.eclipse.jdt.internal.junit.runner.TestExecution.run(
> TestExecution.java:38)
> >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
> >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> > (RemoteTestRunner.java:673)
> >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
> >     at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
> RemoteTestRunner.java:196)
> >  ===================================
> >
> > 以上よろしくお願いします。
> >
> >
> > _______________________________________________
> > Seasar-user mailing list
> > [E-MAIL ADDRESS DELETED]
> > https://ml.seasar.org/mailman/listinfo/seasar-user
> >
> >
> >
>
>
> --
> =============================
> Shinpei Ohtani
> [E-MAIL ADDRESS DELETED]
> =============================
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: http://ml.seasar.org/archives/seasar-user/attachments/20070109/b75298c2/attachment.html 


Seasar-user メーリングリストの案内