TestObject.java 4.0 KB
Newer Older
K
kohsuke 已提交
1 2 3
/*
 * The MIT License
 * 
K
kohsuke 已提交
4
 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts, Yahoo! Inc., InfraDNA, Inc.
K
kohsuke 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
K
kohsuke 已提交
24 25
package hudson.tasks.junit;

26
import hudson.model.AbstractBuild;
27
import hudson.model.AbstractModelObject;
28
import hudson.model.Api;
K
kohsuke 已提交
29 30
import hudson.tasks.test.AbstractTestResultAction;
import org.kohsuke.stapler.export.ExportedBean;
K
kohsuke 已提交
31

K
kohsuke 已提交
32
import java.io.Serializable;
33
import java.util.List;
34

K
kohsuke 已提交
35
/**
K
kohsuke 已提交
36 37 38
 * Stub of base class for all test result objects. The real implementation of
 * the TestObject is in hudson.tasks.test.TestObject. This class simply
 * defines abstract methods so that legacy code will continue to compile.
K
kohsuke 已提交
39
 *
K
kohsuke 已提交
40
 * @deprecated
K
kohsuke 已提交
41
 *      Use {@link hudson.tasks.test.TestObject} instead.
42
 * 
K
kohsuke 已提交
43 44
 * @author Kohsuke Kawaguchi
 */
45
@ExportedBean
46
public abstract class TestObject extends AbstractModelObject implements Serializable {
47
    public abstract AbstractBuild<?,?> getOwner() ; 
K
kohsuke 已提交
48

K
kohsuke 已提交
49
   
50
    public abstract TestObject getParent();
K
kohsuke 已提交
51

K
kohsuke 已提交
52
	public abstract String getId(); 	
53 54 55
	/**
	 * Returns url relative to TestResult
	 */
K
kohsuke 已提交
56
	public abstract String getUrl(); 
57

K
kohsuke 已提交
58 59 60 61 62 63 64 65 66
	public abstract TestResult getTestResult();

    public  abstract AbstractTestResultAction getTestResultAction();

    public  abstract  List<TestAction> getTestActions();

    public abstract <T> T getTestAction(Class<T> klazz);

    /**
67 68 69 70 71
	 * Gets the counter part of this {@link TestObject} in the previous run.
	 * 
	 * @return null if no such counter part exists.
	 */
	public abstract TestObject getPreviousResult();
72 73
	
	public abstract TestObject getResultInBuild(AbstractBuild<?,?> build); 
74 75 76 77 78 79 80 81 82 83

	/**
	 * Time took to run this test. In seconds.
	 */
	public abstract float getDuration();

	/**
	 * Returns the string representation of the {@link #getDuration()}, in a
	 * human readable format.
	 */
K
kohsuke 已提交
84
	public abstract String getDurationString();
85

K
kohsuke 已提交
86 87 88 89 90
    public abstract String getDescription();

    public abstract void setDescription(String description);

    /**
91 92
	 * Exposes this object through the remote API.
	 */
K
kohsuke 已提交
93
	public abstract Api getApi();
94

K
kohsuke 已提交
95
    /**
96 97
	 * Gets the name of this object.
	 */
K
kohsuke 已提交
98
	public abstract String getName();
99

K
kohsuke 已提交
100
    /**
101 102
	 * Gets the version of {@link #getName()} that's URL-safe.
	 */
K
kohsuke 已提交
103
	public abstract String getSafeName();
104

K
kohsuke 已提交
105
    public abstract String getSearchUrl();
106

107
    /**
108
     * Gets the total number of passed tests.
109
     */
110
    public abstract int getPassCount();
111 112

    /**
113
     * Gets the total number of failed tests.
114
     */
115
    public abstract int getFailCount();
116 117

    /**
118
     * Gets the total number of skipped tests.
119
     */
120
    public abstract int getSkipCount();
121

K
kohsuke 已提交
122
    /**
123
     * Gets the total number of tests.
K
kohsuke 已提交
124
     */
K
kohsuke 已提交
125 126 127 128 129 130 131 132 133 134 135
    public abstract int getTotalCount();

    public abstract History getHistory();

//    public abstract Object getDynamic(String token, StaplerRequest req,
//			StaplerResponse rsp);
//
//    public abstract  HttpResponse doSubmitDescription(
//			@QueryParameter String description) throws IOException,
//			ServletException;

K
kohsuke 已提交
136
}