我在eclipse中写仙人掌测试。我已经添加了所需的 jar 文件。
但是当我使用 RunAs -> JUnit Test 运行我的代码时,我遇到了错误
我在 cactus.properties 文件中添加了“cactus.contextURL= http://localhost:8080/test ”。
请帮我看看这里出了什么问题
我收到错误
org.apache.cactus.util.ChainedRuntimeException: Missing Cactus property
[cactus.contextURL]
at
org.apache.cactus.internal.configuration.BaseConfiguration.getContextURL(BaseConfiguration.java:59)
at
org.apache.cactus.internal.configuration.AbstractWebConfiguration.getRedirectorURL_aroundBody0(AbstractWebConfiguration.java:46)
at
org.apache.cactus.internal.configuration.AbstractWebConfiguration.getRedirectorURL_aroundBody1$advice(AbstractWebConfiguration.java:288)
at
org.apache.cactus.internal.configuration.AbstractWebConfiguration.getRedirectorURL(AbstractWebConfiguration.java)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.callRunTest(DefaultHttpClient.java:159)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody0(DefaultHttpClient.java:80)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody1$advice(DefaultHttpClient.java:288)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest(DefaultHttpClient.java)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runWebTest(HttpProtocolHandler.java:159)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest_aroundBody0(HttpProtocolHandler.java:80)
我的代码是
package com.xtremum.taskapplication;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;
import org.junit.Test;
public class CactusServletTest extends ServletTestCase{
public void beginFirst(WebRequest theRequest){
theRequest.setURL( "localhost:8080", "/CactusTest", "/CactusTestServlet", null, null );
System.out.println("in setup");
}
public void testFirst() throws Exception {
assertEquals("Hello Earth!", "ni");
}
public void endFirst(WebResponse theResponse){
System.out.println("in tear down");
}
}