View Javadoc

1   /*
2    *  soapUI, copyright (C) 2006 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.model.testsuite;
14  
15  import java.util.List;
16  
17  /***
18   * Runs a TestCase
19   * 
20   * @author Ole.Matzura
21   */
22  
23  public interface TestRunner 
24  {
25  	/***
26  	 * Gets the TestCase being run
27  	 * 
28  	 * @return the TestCase being run
29  	 */
30  	
31  	public TestCase getTestCase();
32  
33  	/***
34  	 * Gets the accumulated results so far; each TestStep returns a TestStepResult when running.
35  	 * 
36  	 * @return the accumulated results so far
37  	 */
38  	
39  	public List<TestStepResult> getResults();
40  
41  	/***
42  	 * Gets the current status of this TestRunner
43  	 */
44  	
45  	public Status getStatus();
46  
47  	public enum Status { INITIALIZED, RUNNING, CANCELED, FINISHED, FAILED };
48  	
49  	/***
50  	 * Starts running this TestRunners TestCase. If the async flag is set to true, this method will return
51  	 * directly, otherwise it will block until the TestCase is finished
52  	 * 
53  	 * @param async flag controlling if TestCase should be run in seperate or callers thread.
54  	 */
55  	
56  	public void start( boolean async );
57  
58  	/***
59  	 * Returns the time taken by this runner since its last start
60  	 */
61  	
62  	public long getTimeTaken();
63  
64  	/***
65  	 * Returns the time this runner was last started
66  	 */
67  	
68  	public long getStartTime();
69  
70  	/***
71  	 * Blocks until this runner is finished, (returns directly if it already has finished)
72  	 */
73  	
74  	public Status waitUntilFinished();
75  
76  	/***
77  	 * Cancels an ongoing test run with the specified reason
78  	 */
79  	
80  	public void cancel( String reason );
81  
82  	/***
83  	 * Fails an ongoing test run with the specified reason
84  	 */
85  	
86  	public void fail( String reason );
87  
88  	/***
89  	 * Gets the reason why a running test was canceled or failed.
90  	 */
91  	
92  	public String getReason();
93  	
94  	/***
95  	 * Transfers execution of this TestRunner to the TestStep with the specified index in the TestCase
96  	 */
97  	
98  	public void gotoStep( int index );
99  	
100 	/***
101 	 * Transfers execution of this TestRunner to the TestStep with the specified name in the TestCase
102 	 */
103 	
104 	public void gotoStepByName( String stepName );
105 }