001: package org.jzonic.webtester;
002:
003: import java.util.List;
004: import java.util.Vector;
005:
006: import org.jzonic.webtester.commands.WebTestNodeResult;
007:
008: /**
009: * The WebTestResult contains all informations about a testcase.
010: *
011: * @author Mecky
012: */
013: public class WebTestResult {
014:
015: private String webTestName;
016: private boolean success;
017: private long started;
018: private long stop;
019: private WebTestNodeResult errorNode;
020: private List results;
021:
022: public WebTestResult(String webTestName) {
023: this .webTestName = webTestName;
024: results = new Vector();
025: success = true;
026: }
027:
028: /**
029: * Returns the amount of milliseconds that the entire
030: * test took
031: *
032: * @return duration as milliseconds
033: */
034: public long getDuration() {
035: return stop - started;
036: }
037:
038: /**
039: * Starts the timing for the test
040: *
041: */
042: public void startTiming() {
043: started = System.currentTimeMillis();
044: }
045:
046: /**
047: * Stops the timing for the test
048: *
049: */
050: public void stopTiming() {
051: stop = System.currentTimeMillis();
052: }
053:
054: /**
055: * Returns the state of the entire test
056: *
057: * @return true if the test was successfull
058: */
059: public boolean isSuccess() {
060: return success;
061: }
062:
063: public void setSuccess(boolean success) {
064: this .success = success;
065: }
066:
067: /**
068: * This method adds a WebTestNodeResult to the list of results
069: * for this test.
070: *
071: * @param res the result of a WebTestNode
072: */
073: public void addResult(WebTestNodeResult res) {
074: results.add(res);
075:
076: }
077:
078: /**
079: */
080: public WebTestNodeResult getErrorNode() {
081: return errorNode;
082: }
083:
084: public void setErrorNode(WebTestNodeResult errorNode) {
085: this .errorNode = errorNode;
086: }
087:
088: /**
089: * @return Returns the webTestName.
090: */
091: public String getWebTestName() {
092: return webTestName;
093: }
094:
095: /**
096: * @param webTestName The webTestName to set.
097: */
098: public void setWebTestName(String webTestName) {
099: this .webTestName = webTestName;
100: }
101:
102: /**
103: * @return
104: */
105: public List getTestResults() {
106: return results;
107: }
108: }
|