cobertura mavenプラグインを使用して、Springベースのアプリケーションのテストコードカバレッジに関するレポートを作成しています。私の単体テストは次のように構成されています。
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/testAppContext.xml")
public class TestCase extends TestBase
testAppContext.xml-/src/test/resources/testAppContext.xmlにあるSpringIOC構成
そして、私のcoberturaの関連するpom.xml部分は次のとおりです。
<build>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
...
<build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
「mvncleaninstall」を作成すると正常に動作しますが、「mvn site」を作成すると、「Autowired依存関係の挿入に失敗しました」という基になる「ApplicationContextの読み込みに失敗しました」が原因でスプリングベースのテストが失敗し、誤ったレポートを受け取りますテストカバレッジについて。
これは、「サイト」の目標などでtestAppContext.xmlがクラスパスにないことが原因である可能性があります。この問題を解決する方法について何か提案はありますか?
ご協力ありがとうございました!