001: /*
002: * soapUI, copyright (C) 2004-2007 eviware.com
003: *
004: * soapUI is free software; you can redistribute it and/or modify it under the
005: * terms of version 2.1 of the GNU Lesser General Public License as published by
006: * the Free Software Foundation.
007: *
008: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
009: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
010: * See the GNU Lesser General Public License for more details at gnu.org.
011: */
012:
013: package com.eviware.soapui.model.testsuite;
014:
015: import java.util.List;
016:
017: /**
018: * Runs a TestCase
019: *
020: * @author Ole.Matzura
021: */
022:
023: public interface TestRunner {
024: /**
025: * Gets the TestCase being run
026: *
027: * @return the TestCase being run
028: */
029:
030: public TestCase getTestCase();
031:
032: /**
033: * Gets the accumulated results so far; each TestStep returns a TestStepResult when running.
034: *
035: * @return the accumulated results so far
036: */
037:
038: public List<TestStepResult> getResults();
039:
040: /**
041: * Gets the current status of this TestRunner
042: */
043:
044: public Status getStatus();
045:
046: public enum Status {
047: INITIALIZED, RUNNING, CANCELED, FINISHED, FAILED
048: };
049:
050: /**
051: * Starts running this TestRunners TestCase. If the async flag is set to true, this method will return
052: * directly, otherwise it will block until the TestCase is finished
053: *
054: * @param async flag controlling if TestCase should be run in seperate or callers thread.
055: */
056:
057: public void start(boolean async);
058:
059: /**
060: * Returns the time taken by this runner since its last start
061: */
062:
063: public long getTimeTaken();
064:
065: /**
066: * Returns the time this runner was last started
067: */
068:
069: public long getStartTime();
070:
071: /**
072: * Blocks until this runner is finished, (returns directly if it already has finished)
073: */
074:
075: public Status waitUntilFinished();
076:
077: /**
078: * Cancels an ongoing test run with the specified reason
079: */
080:
081: public void cancel(String reason);
082:
083: /**
084: * Fails an ongoing test run with the specified reason
085: */
086:
087: public void fail(String reason);
088:
089: /**
090: * Gets the reason why a running test was canceled or failed.
091: */
092:
093: public String getReason();
094:
095: /**
096: * Transfers execution of this TestRunner to the TestStep with the specified index in the TestCase
097: */
098:
099: public void gotoStep(int index);
100:
101: /**
102: * Transfers execution of this TestRunner to the TestStep with the specified name in the TestCase
103: */
104:
105: public void gotoStepByName(String stepName);
106: }
|