01: /*
02: * Created on 15.10.2004
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Style - Code Templates
06: */
07: package org.jzonic.webtester;
08:
09: import java.util.Map;
10:
11: import org.jzonic.webtester.writer.WebTestResultConsoleWriter;
12:
13: import junit.framework.TestCase;
14:
15: /**
16: * @author Mecky
17: *
18: * TODO To change the template for this generated type comment go to
19: * Window - Preferences - Java - Code Style - Code Templates
20: */
21: public class InternalFormWebTest extends TestCase {
22:
23: private SimpleWebServer server;
24:
25: public void setUp() throws Exception {
26: server = new SimpleWebServer();
27: }
28:
29: public void tearDown() {
30: server.shutdown();
31: }
32:
33: public void testForm() {
34: WebTestFileReader reader = new WebTestFileReader();
35: WebTestResult result = reader
36: .parseFile("internal_test/form.test");
37: Map params = server.getParameters();
38: assertTrue(result.isSuccess());
39: assertEquals("My+NAME", (String) params.get("name"));
40: assertEquals("20", (String) params.get("age"));
41: assertEquals("Hello+world", (String) params.get("text"));
42: assertEquals("1", (String) params.get("mode"));
43: assertEquals("yes", (String) params.get("create"));
44: WebTestResultConsoleWriter writer = new WebTestResultConsoleWriter();
45: writer.generateResult(result);
46: }
47: }
|