Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 187864
Collapse All | Expand All

(-)templates/TabularReport.rptdesign (-6 lines)
Lines 115-126 Link Here
115
                    <property name="dataType">string</property>
115
                    <property name="dataType">string</property>
116
                </structure>
116
                </structure>
117
            </list-property>
117
            </list-property>
118
            <list-property name="filter">
119
                <structure>
120
                    <expression name="expr">((row["Test suite"] == "AllTests") | (row["Test suite"] == "AllManualTests") |  (row["Test suite"] == "AllGUITests"))</expression>
121
                    <expression name="value1">false</expression>
122
                </structure>
123
            </list-property>
124
            <structure name="cachedMetaData">
118
            <structure name="cachedMetaData">
125
                <list-property name="resultSet">
119
                <list-property name="resultSet">
126
                    <structure>
120
                    <structure>
(-)src/org/eclipse/tptp/test/report/birt/internal/TabularTPFTestSuiteReportElement.java (+2 lines)
Lines 132-137 Link Here
132
		allTestSuites = ResolveTestExecutions.getTestSuites(list);
132
		allTestSuites = ResolveTestExecutions.getTestSuites(list);
133
		executionResults = ResolveTestExecutions.getExecutionResultsMap(allTestSuites, (TestContextObject)context);
133
		executionResults = ResolveTestExecutions.getExecutionResultsMap(allTestSuites, (TestContextObject)context);
134
134
135
		allTestSuites = ResolveTestExecutions.getReportableTestSuites(list, executionResults);
136
		
135
		//generate root index report
137
		//generate root index report
136
		String imgDir = (String)context.getProperty(IBIRTConstants.CONTEXT_IMG_DIR);
138
		String imgDir = (String)context.getProperty(IBIRTConstants.CONTEXT_IMG_DIR);
137
		String outputFolder = (String)context.getProperty(IBIRTConstants.CONTEXT_OUT_FOLDER); 
139
		String outputFolder = (String)context.getProperty(IBIRTConstants.CONTEXT_OUT_FOLDER); 
(-)src/org/eclipse/tptp/test/report/birt/internal/ResolveTestExecutions.java (+143 lines)
Lines 27-32 Link Here
27
import org.eclipse.hyades.models.common.testprofile.TPFExecutionEvent;
27
import org.eclipse.hyades.models.common.testprofile.TPFExecutionEvent;
28
import org.eclipse.hyades.models.common.testprofile.TPFExecutionHistory;
28
import org.eclipse.hyades.models.common.testprofile.TPFExecutionHistory;
29
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
29
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
30
import org.eclipse.hyades.models.common.testprofile.TPFTestCase;
30
import org.eclipse.hyades.models.common.testprofile.TPFTestSuite;
31
import org.eclipse.hyades.models.common.testprofile.TPFTestSuite;
31
import org.eclipse.hyades.models.common.util.ExecutionUtil;
32
import org.eclipse.hyades.models.common.util.ExecutionUtil;
32
33
Lines 159-164 Link Here
159
		}
160
		}
160
	}
161
	}
161
    
162
    
163
	/* PES --> */
164
	
165
	public static EList getReportableTestSuites(EList rootTestSuites, Map executionResults){
166
		
167
		EList filteredTestSuites = new BasicEList();
168
        Iterator rootTestSuitesIterator = rootTestSuites.iterator();
169
        
170
        while (rootTestSuitesIterator.hasNext()) {
171
172
                EList ancestorTestSuites = new BasicEList();
173
                
174
                resolveReportableReferencedTestSuites(ancestorTestSuites, ((TPFTestSuite)(rootTestSuitesIterator.next())), executionResults);
175
                
176
                Iterator subIterator = ancestorTestSuites.iterator();
177
                
178
                while (subIterator.hasNext()) {
179
                	
180
                    TPFTestSuite currentTestSuite = ((TPFTestSuite) (subIterator.next()));
181
                    
182
                    if ((currentTestSuite.getName() != null) && (currentTestSuite.getName().length() > 0) && (!filteredTestSuites.contains(currentTestSuite))) {
183
                    	filteredTestSuites.add(currentTestSuite);
184
                    }
185
                }
186
        }
187
        
188
        return filteredTestSuites;
189
	}
190
	
191
	protected static void resolveReportableReferencedTestSuites(EList ancestorTestSuites, TPFTestSuite testSuite, Map executionResults) {
192
193
		//Step 1. Add the parameter test suite:
194
        if(hasExecutionResults(testSuite.getId(), executionResults)){
195
        	ancestorTestSuites.add(testSuite);
196
        }
197
        else if(containsTestCaseInvocations(testSuite)){
198
        	
199
        	//Walk up the tree to see if there is an execution result for an ancestor:
200
        	boolean ancestorHasExecutionResults = false;
201
        	Iterator ancestorTestSuitesIterator = ancestorTestSuites.iterator();
202
        	
203
        	while(ancestorTestSuitesIterator.hasNext()){
204
        		
205
        		if(hasExecutionResults(((TPFTestSuite)(ancestorTestSuitesIterator.next())).getId(), executionResults)){
206
        			
207
        			ancestorHasExecutionResults = true;
208
        			break;
209
        		}
210
        	}
211
        	
212
        	if(!ancestorHasExecutionResults){
213
        		ancestorTestSuites.add(testSuite);
214
        	}
215
        }
216
217
		//Step 2. Add all the referenced test suite(s):   
218
		IImplementor implementor = testSuite.getImplementor();
219
220
		if (implementor != null) {
221
222
			IBlock block = implementor.getBlock();
223
224
			if (block != null) {	 			
225
				resolveReportableReferencedTestSuites(ancestorTestSuites, block, executionResults);
226
			}            
227
		}
228
	}	
229
230
	private static void resolveReportableReferencedTestSuites(EList ancestorTestSuites, IBlock block, Map executionResults) {
231
232
		Iterator actionsIterator = block.getActions().iterator();
233
234
		while(actionsIterator.hasNext()) {
235
236
			IAction action = ((IAction)(actionsIterator.next()));
237
238
			if (action instanceof ITestInvocation) {
239
240
				ITest test = ((ITestInvocation)(action)).getInvokedTest();
241
242
				//Only invocations of external test suites currently not in the list are added:
243
				if ((test instanceof TPFTestSuite) && (!ancestorTestSuites.contains(test))) {
244
					resolveReportableReferencedTestSuites(ancestorTestSuites, ((TPFTestSuite)(test)), executionResults);
245
				} 
246
			} 
247
			else if (action instanceof ILoop) {
248
				resolveReportableReferencedTestSuites(ancestorTestSuites, ((ILoop)(action)).getBlock(), executionResults);
249
			}
250
		}
251
	}
252
	
253
	private static boolean containsTestCaseInvocations(TPFTestSuite testSuite){
254
		
255
		IImplementor implementor = testSuite.getImplementor();
256
257
		if (implementor != null) {
258
259
			IBlock block = implementor.getBlock();
260
261
			if (block != null) {	 			
262
				return (containsTestCaseInvocations(block));
263
			}            
264
		}
265
		
266
		return false;
267
	}
268
	
269
	private static boolean containsTestCaseInvocations(IBlock block) {
270
271
		Iterator actionsIterator = block.getActions().iterator();
272
273
		while(actionsIterator.hasNext()) {
274
275
			IAction action = ((IAction)(actionsIterator.next()));
276
277
			if (action instanceof ITestInvocation) {
278
279
				if(((ITestInvocation)(action)).getInvokedTest() instanceof TPFTestCase){
280
					return true;
281
				}
282
			} 
283
			else if (action instanceof ILoop) {
284
				containsTestCaseInvocations(((ILoop)(action)).getBlock());
285
			}
286
		}
287
		
288
		return false;
289
	}
290
	
291
	private static boolean hasExecutionResults(String testSuiteId, Map executionResults){
292
		
293
		if(executionResults.containsKey(testSuiteId)){
294
			
295
			List testSuiteExecutionResults = ((List)(executionResults.get(testSuiteId)));
296
			
297
			return (testSuiteExecutionResults.size() > 0);
298
		}
299
		
300
		return false;
301
	}
302
303
	/* <-- PES */
304
	
162
	/**
305
	/**
163
	 * This method filters the map of TestSuites to ExecutionResults by 
306
	 * This method filters the map of TestSuites to ExecutionResults by 
164
	 * removing all but the last execution result that falls within the 
307
	 * removing all but the last execution result that falls within the 

Return to bug 187864