XTest.java
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package xxxx;
import java.io.IOException;
import java.net.URL;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import test.Tests;
@RunWith(Arquillian.class)
public class XTest {
private static final String PATH = "src/test/resources/xxx";
@ArquillianResource
private URL deploymentUrl;
@Deployment(testable = false)
public static WebArchive createDeployment() {
return Tests.createDeployment().addClass(XServlet.class)
.addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml");
}
@Test
public void xxxx() {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(deploymentUrl + "/login");
try {
int status = client.executeMethod(method);
System.out.println(status);
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// browser.open(deploymentUrl + "login");
// browser.type("id=xxx-input", "demo");
// browser.waitForPageToLoad("15000");
// assertTrue("User should be logged in!",
// browser.isElementPresent("xpath=//li[contains(text(), 'Welcome')]"));
// assertTrue("Username should be shown!",
// browser.isElementPresent("xpath=//p[contains(text(), 'You are signed in as demo.')]"));
}
}