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 136186
Collapse All | Expand All

(-)src/org/eclipse/tptp/test/auto/gui/internal/runner/AutoGUIRunner.java (-28 / +86 lines)
Lines 281-287 Link Here
281
			
281
			
282
			
282
			
283
			/* Run the tests */			
283
			/* Run the tests */			
284
			startTime = getCurrentTime();			
284
			startTime = getCurrentTime();
285
			
285
			runner.runTest (testSuiteObj, EXECUTION_RUN_MODE);			
286
			runner.runTest (testSuiteObj, EXECUTION_RUN_MODE);			
286
		}
287
		}
287
		catch(Throwable e)
288
		catch(Throwable e)
Lines 381-393 Link Here
381
		}
382
		}
382
		
383
		
383
		/* Holds the next executable action that is to be executed */
384
		/* Holds the next executable action that is to be executed */
384
		Object nextExecution;
385
		Object nextExecution = null;
385
			
386
		/* Holds the test suite if we are executing a test suite reference, added for bugzilla_136186*/
387
		TestSuite nestedSuite = new TestSuite();
388
		/* To keep track of when we are in a reference to a test suite*/
389
		boolean inTestSuite =false;
390
		/* To keep track of whether we are in a Loop inside of a test suite reference*/
391
		boolean loopStarted = false;
392
		/* The index of test cases in a references Loop or test suite*/
393
		int index=0;
394
	
386
		/* Walk through every element that needs to be executed in our test suite */
395
		/* Walk through every element that needs to be executed in our test suite */
387
		if (initializeState == null)
396
		if (initializeState == null)
388
		{
397
		{
389
			while ((nextExecution = nextExecution(mode, testSuite)) != null )
398
			
399
			while (((inTestSuite)|| (nextExecution =nextExecution(mode, testSuite))!=null))
390
			{
400
			{
401
				// Added for bugzilla_136186 to add the ability to step through test 
402
				//cases in a referenced test suite
403
				// Liz D.
404
				if (inTestSuite)
405
				{
406
					nextExecution = nestedSuite.getActions().get(index); 
407
					
408
					if (nextExecution instanceof org.eclipse.tptp.test.manual.runner.core.internal.model.Loop)
409
					{
410
						if (loopStarted)
411
						{
412
							nextExecution = ((org.eclipse.tptp.test.manual.runner.core.internal.model.Loop)nextExecution).getActions().get(index);
413
							loopStarted=false;
414
						}
415
						else
416
							loopStarted=true;
417
					}
418
					
419
				}
420
				
391
				try
421
				try
392
				{
422
				{
393
					errorOccurred = false;
423
					errorOccurred = false;
Lines 408-414 Link Here
408
						if (lastLoop != null)
438
						if (lastLoop != null)
409
						{
439
						{
410
							IActionOwner parentOfLastLoop = lastLoop.getOwner();
440
							IActionOwner parentOfLastLoop = lastLoop.getOwner();
411
													
412
							String parentOfLastLoopId = getActionId(parentOfLastLoop);
441
							String parentOfLastLoopId = getActionId(parentOfLastLoop);
413
							String nextExecutionId = getActionId(nextExecution);
442
							String nextExecutionId = getActionId(nextExecution);
414
							
443
							
Lines 425-433 Link Here
425
								continue;
454
								continue;
426
							}
455
							}
427
							
456
							
428
							else if (((Action)nextExecution).getOwner() instanceof TestSuite)
457
							else if (((Action)nextExecution).getOwner() instanceof TestSuite && !inTestSuite)
429
							{
458
							{
430
								sendAllLoopStop ();
459
								sendAllLoopStop ();
460
								
431
							}
461
							}
432
						}
462
						}
433
						
463
						
Lines 436-450 Link Here
436
						{				
466
						{				
437
							sendLoopStart ((org.eclipse.tptp.test.manual.runner.core.internal.model.Loop)nextExecution);						
467
							sendLoopStart ((org.eclipse.tptp.test.manual.runner.core.internal.model.Loop)nextExecution);						
438
							continue;
468
							continue;
469
						
439
						}
470
						}
440
						
471
						
441
						/* If the action is a test invocation, then send the test invocation */
472
						/* If the action is a test invocation, then send the test invocation */
442
						else if (nextExecution instanceof ExtendedTestInvocation)
473
						 if (nextExecution instanceof ExtendedTestInvocation )
443
						{
474
						{
444
							lastAction = (ExtendedTestInvocation)nextExecution;
475
							lastAction = (ExtendedTestInvocation)nextExecution;
445
							testCaseObject = lastAction.getTest();
476
							testCaseObject = lastAction.getTest();
477
							sendTestInvocation(lastAction, InvocationEvent.STATUS_SUCCESSFUL, lastAction.getName());
446
							
478
							
447
							sendTestInvocation(lastAction, InvocationEvent.STATUS_SUCCESSFUL, null);
479
							if (testCaseObject instanceof TestSuite)
480
							{
481
								nestedSuite = ((TestSuite)testCaseObject);
482
								inTestSuite=true;
483
								index =0;
484
								continue;
485
							}
448
						}
486
						}
449
						
487
						
450
						/* Otherwise continue with the main loop */
488
						/* Otherwise continue with the main loop */
Lines 452-466 Link Here
452
						{
490
						{
453
							continue;
491
							continue;
454
						}
492
						}
455
					}				
493
					}
456
					
494
					if (!((testCaseObject instanceof ExtendedTestCase)))
457
					if (!(testCaseObject instanceof ExtendedTestCase))
458
						continue;
495
						continue;
459
					
496
					
460
					/* Switch to the perspective representing our starting point */
497
					/* Switch to the perspective representing our starting point */
461
					final ExtendedTestCase testCase = (ExtendedTestCase)testCaseObject;			
498
					final ExtendedTestCase testCase = (ExtendedTestCase)testCaseObject;	
499
					
462
					final String startingPoint = testCase.getProperty(String.valueOf(GUITestCaseProperties.STARTING_PT));
500
					final String startingPoint = testCase.getProperty(String.valueOf(GUITestCaseProperties.STARTING_PT));
463
					
501
					
502
					
464
					/* This is a required field.  In case it is not set, then mark the test case with
503
					/* This is a required field.  In case it is not set, then mark the test case with
465
					 * a verdict of error */
504
					 * a verdict of error */
466
					if (startingPoint == null || startingPoint.length() <= 0)
505
					if (startingPoint == null || startingPoint.length() <= 0)
Lines 502-507 Link Here
502
								
541
								
503
								workbench.showPerspective(startingPoint, window);
542
								workbench.showPerspective(startingPoint, window);
504
							}
543
							}
544
				    	
505
							catch (WorkbenchException e)
545
							catch (WorkbenchException e)
506
							{			
546
							{			
507
								errorOccurred = true;
547
								errorOccurred = true;
Lines 632-638 Link Here
632
													
672
													
633
								errorOccurred = true;
673
								errorOccurred = true;
634
								isDone = true;
674
								isDone = true;
635
							}						
675
								
676
							}// end whlie						
636
					    }
677
					    }
637
					    	
678
					    	
638
					    public boolean isDone()
679
					    public boolean isDone()
Lines 811-819 Link Here
811
				
852
				
812
				/* Send out a stop event on the test case invocation */
853
				/* Send out a stop event on the test case invocation */
813
				if (mode == EXECUTION_RUN_MODE)
854
				if (mode == EXECUTION_RUN_MODE)
814
					sendTypeEvent(TypedEvent.STOP, null);			
855
					sendTypeEvent(TypedEvent.STOP, null);
815
			}
856
				index ++;
816
		}	
857
				if (index >= (nestedSuite.getActions().size()) && inTestSuite)
858
				{
859
					sendSuiteStop();
860
					inTestSuite=false;
861
				}
862
					
863
			}// end while
864
		}// end if	
817
				
865
				
818
		if (mode == EXECUTION_RUN_MODE)
866
		if (mode == EXECUTION_RUN_MODE)
819
		{
867
		{
Lines 950-956 Link Here
950
	
998
	
951
	/**
999
	/**
952
	 * Returns the last container id according to what is stored in the
1000
	 * Returns the last container id according to what is stored in the
953
	 * execution event stack.  A container is either a loop or the ROOT.
1001
	 * execution event stack.  A container is either a loop or the ROOT. It could also be a nested test suite invocation
954
	 * 
1002
	 * 
955
	 * @return The last container id.
1003
	 * @return The last container id.
956
	 */
1004
	 */
Lines 962-969 Link Here
962
		{
1010
		{
963
			if (stackItems[i] instanceof LoopEvent)
1011
			if (stackItems[i] instanceof LoopEvent)
964
				return ((LoopEvent)stackItems[i]).getId();
1012
				return ((LoopEvent)stackItems[i]).getId();
1013
			else if (stackItems[i] instanceof InvocationEvent){
1014
				return ((InvocationEvent)stackItems[i]).getId();
1015
			}
965
		}
1016
		}
966
		
967
		return "ROOT";
1017
		return "ROOT";
968
	}
1018
	}
969
	
1019
	
Lines 976-985 Link Here
976
	{			
1026
	{			
977
		TypedEvent event = new TypedEvent();
1027
		TypedEvent event = new TypedEvent();
978
		String parentId = lastExecutionEventId();
1028
		String parentId = lastExecutionEventId();
979
		if (executionEventStack.size() > 0)
1029
                                                                                                          		if (executionEventStack.size() > 0)
980
			event.setOwnerId(((ExecutionEvent)executionEventStack.peek()).getOwnerId());
1030
			event.setOwnerId(((ExecutionEvent)executionEventStack.peek()).getOwnerId());
981
		event.setParentId(parentId);
1031
		event.setParentId(parentId);
982
		event.setText(text);
983
		event.setType(type);
1032
		event.setType(type);
984
		
1033
		
985
		ModelUtil.getEventLogger().log(event);
1034
		ModelUtil.getEventLogger().log(event);
Lines 988-994 Link Here
988
			executionEventStack.pop();
1037
			executionEventStack.pop();
989
	}
1038
	}
990
	
1039
	
991
	
1040
	/**
1041
	 * Added for bugzilla_136186 in order to send an additional Stop event for a test suite
1042
	 */
1043
	private void sendSuiteStop()
1044
	{
1045
		sendTypeEvent(TypedEvent.STOP, null);
1046
1047
	}
992
	/**
1048
	/**
993
	 * Sends a loop event
1049
	 * Sends a loop event
994
	 */
1050
	 */
Lines 1034-1050 Link Here
1034
		InvocationEvent event = new InvocationEvent();
1090
		InvocationEvent event = new InvocationEvent();
1035
		associateEventIds(testInvocation, event);
1091
		associateEventIds(testInvocation, event);
1036
1092
1037
		event.setText(text);
1093
		
1038
		
1094
		
1039
		if(testInvocation.getTest() == null)
1095
		if(testInvocation.getTest() == null)
1040
		{
1096
		{
1041
			event.setStatus(InvocationEvent.STATUS_UNSUCCESSFUL);
1097
			event.setStatus(InvocationEvent.STATUS_UNSUCCESSFUL);
1042
			event.setReason(InvocationEvent.REASON_NO_BEHAVIOR);
1098
			event.setReason(InvocationEvent.REASON_NO_BEHAVIOR);
1099
			
1043
		}
1100
		}
1044
		else
1101
		else
1045
		{
1102
		{
1046
			event.setInvokedId(ModelUtil.appendHierarchyId(testInvocation.getTest(), event.getOwnerId()));
1103
			event.setInvokedId(ModelUtil.appendHierarchyId(testInvocation.getTest(), event.getOwnerId()));
1047
			event.setStatus(status);
1104
			event.setStatus(status);
1105
			
1106
			
1048
		}	
1107
		}	
1049
		
1108
		
1050
		ModelUtil.getEventLogger().log(event);
1109
		ModelUtil.getEventLogger().log(event);
Lines 1075-1084 Link Here
1075
		 */
1134
		 */
1076
		InvocationEvent invocationEvent = (InvocationEvent)executionEventStack.peek();
1135
		InvocationEvent invocationEvent = (InvocationEvent)executionEventStack.peek();
1077
		verdictEvent.setId(invocationEvent.getId() + "_verdict");
1136
		verdictEvent.setId(invocationEvent.getId() + "_verdict");
1078
		verdictEvent.setOwnerId(ModelUtil.getHierarchyId(lastAction.getTest()));
1137
		//verdictEvent.setOwnerId(ModelUtil.getHierarchyId(lastAction.getTest()));
1079
		verdictEvent.setParentId(invocationEvent.getId());
1138
		verdictEvent.setParentId(invocationEvent.getId());
1080
		verdictEvent.setVerdict(verdict);				
1139
		verdictEvent.setVerdict(verdict);				
1081
1140
		verdictEvent.setOwnerId(invocationEvent.getId());
1082
		
1141
		
1083
		if(reason != null && reason.trim().length() > 0)
1142
		if(reason != null && reason.trim().length() > 0)
1084
		{
1143
		{
Lines 1086-1092 Link Here
1086
			verdictEvent.setReason(VerdictEvent.REASON_SEE_DESCRIPTION);
1145
			verdictEvent.setReason(VerdictEvent.REASON_SEE_DESCRIPTION);
1087
		}
1146
		}
1088
		ModelUtil.getEventLogger().log(verdictEvent);
1147
		ModelUtil.getEventLogger().log(verdictEvent);
1089
1090
		testInvocation.setVerdictEvent(verdictEvent);
1148
		testInvocation.setVerdictEvent(verdictEvent);
1091
	}
1149
	}
1092
	
1150
	
Lines 1105-1111 Link Here
1105
1163
1106
		event.setOwnerId(ownerId);
1164
		event.setOwnerId(ownerId);
1107
		event.setId(eventId);
1165
		event.setId(eventId);
1108
		event.setParentId(parentId);	
1166
		event.setParentId(parentId);
1167
	
1109
		
1168
		
1110
		executionEventStack.push(event);
1169
		executionEventStack.push(event);
1111
	}
1170
	}
Lines 1144-1150 Link Here
1144
		return nextExecution;
1203
		return nextExecution;
1145
	}
1204
	}
1146
	
1205
	
1147
	
1148
	private Object getNextExecutableAction() 
1206
	private Object getNextExecutableAction() 
1149
	{
1207
	{
1150
		if (actionIteratorStack.size() <= 0)
1208
		if (actionIteratorStack.size() <= 0)
Lines 1161-1167 Link Here
1161
			
1219
			
1162
			
1220
			
1163
			/* If the invocation is disabled, then just skip it */
1221
			/* If the invocation is disabled, then just skip it */
1164
			if (nextExecutableAction instanceof TestInvocation)
1222
			if (nextExecutableAction instanceof TestInvocation )
1165
			{
1223
			{
1166
				TestInvocation testInvocation = (TestInvocation)nextExecutableAction;
1224
				TestInvocation testInvocation = (TestInvocation)nextExecutableAction;
1167
				GeneralPropertyRetriever properties = extendedTestSuite.getProperties();
1225
				GeneralPropertyRetriever properties = extendedTestSuite.getProperties();

Return to bug 136186