気ままなつぶやき

おべんきょしたこととか

【springframework】 testng

あい(`・ω・´)ゞ


MEMOです。。|д゚)チラッ



springframeworkで、testngつかて単体テスト
(springframework 3.0.6.RELEASE, testng 5.14)


@ContextConfiguration使って、applicationContext.xmlを読み込めるよ。

ただし、
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
を継承しておかないと、いくら設定ファイル指定してもエラーになります。

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;


@ContextConfiguration(locations={"classpath:config/applicationContext.xml"})
public class PnskTest extends AbstractTestNGSpringContextTests {

      @Test
      public void とりあえずのテスト() {
          System.out.println("test");
      }

}


なんとなく、テストメソッドを日本語にするブーム(´・ω・`)


jenkinsとかで見ると見やすいっていうタレコミにより。。


やっぱやめるかもしれんけど。。



おほほ