• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.cts.tradefed.testtype;
18 
19 import com.android.ddmlib.testrunner.TestIdentifier;
20 import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
21 
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.io.OutputStream;
25 import java.util.Collection;
26 import java.util.List;
27 
28 /**
29  * Interface for accessing test plan data.
30  */
31 public interface ITestPlan {
32 
33     /**
34      * Populates the test plan data from given XML stream.
35      *
36      * @param xmlStream the {@link InputStream} that contains the test plan xml.
37      */
parse(InputStream xmlStream)38     public void parse(InputStream xmlStream) throws ParseException;
39 
40     /**
41      * Gets a sorted list of test ids contained in this plan.
42      */
getTestIds()43     public Collection<String> getTestIds();
44 
45     /**
46      * Gets a sorted {@link List} of test names contained in this plan.
47      */
getTestNames()48     public List<String> getTestNames();
49 
50     /**
51      * Gets the {@link TestFilter} that should be used to filter tests from given package.
52      */
getTestFilter(String id)53     public TestFilter getTestFilter(String id);
54 
55     /**
56      * Add a package to this test plan
57      * @param id
58      */
addPackage(String id)59     public void addPackage(String id);
60 
61     /**
62      * Add a excluded test to this test plan
63      *
64      * @param id the package id
65      * @param testToExclude the test to exclude for given package
66      */
addExcludedTest(String id, TestIdentifier testToExclude)67     public void addExcludedTest(String id, TestIdentifier testToExclude);
68 
69     /**
70      * Adds the list of excluded tests for given package
71      *
72      * @param id
73      * @param excludedTests
74      */
addExcludedTests(String id, Collection<TestIdentifier> excludedTests)75     public void addExcludedTests(String id, Collection<TestIdentifier> excludedTests);
76 
77     /**
78      * Serialize the contents of this test plan.
79      *
80      * @param xmlOutStream the {@link OutputStream} to serialize test plan contents to
81      * @throws IOException
82      */
serialize(OutputStream xmlOutStream)83     public void serialize(OutputStream xmlOutStream) throws IOException;
84 
85     /**
86      * @return the test plan name
87      */
getName()88     public String getName();
89 
90 }
91