基于 JUnit 单元测试框架 Arquillian Core 1.0.1.Final 发布
jopen 12年前
<div id="p_fullcontent" class="detail"> <p><img alt="基于 JUnit 单元测试框架 Arquillian" src="https://simg.open-open.com/show/26802b705766a9d9dabf23f714528446.png" width="451" height="165" /></p> <p><a href="/misc/goto?guid=4958342640891626807" target="_blank">Arquillian </a>可让你在远程或者嵌入式的容器里测试业务逻辑,同时可作为一个压缩包发布到容器中,并通过客户端来进行交互测试。</p> <p>Arquillian 是一个可以方便的在现有类基础性扩展测试用例,基于 JUnit 。</p> <p>单元测试框架 Arquillian 发布了 1.0.1 最终版本。这是一个维护版本,主要改进记录包括:</p> <p>Bug修复</p> <ul class="unstyled"> <li><a href="/misc/goto?guid=4958342641704534849">ARQ-793</a> - Arquillian config-impl-base is not a part of junit|testng-standalone</li> <li><a href="/misc/goto?guid=4958342642492833917">ARQ-889</a> - Arquillian BOM causes ShrinkWrap dependencies to be included in the lib folder of a WAR archive</li> </ul> <p>增强</p> <ul class="unstyled"> <li><a href="/misc/goto?guid=4958342643285869099">ARQ-846</a> - Protect ExceptionProxy againts Non-Serializable origin</li> </ul> <p>Feature Request</p> <ul class="unstyled"> <li><a href="/misc/goto?guid=4958342644075365042">ARQ-971</a> - DeploymentGenerator should allow AuxiliaryArchiveAppenders to return null Archives</li> </ul> <p></p> <p>示例代码:</p> <p></p> <pre class="brush:java; toolbar: true; auto-links: false;">import static org.junit.Assert.assertEquals; import javax.ejb.EJB; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(Arquillian.class) public class GreeterTest { @Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addClass(Greeter.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } @Inject Greeter greeter; @Test public void should_create_greeting() { assertEquals("Hello, Earthling!", greeter.greet("Earthling")); } }</pre> <p></p> </div>