当前位置: 首页>>代码示例>>Java>>正文


Java ITestCaseElement类代码示例

本文整理汇总了Java中org.eclipse.jdt.junit.model.ITestCaseElement的典型用法代码示例。如果您正苦于以下问题:Java ITestCaseElement类的具体用法?Java ITestCaseElement怎么用?Java ITestCaseElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITestCaseElement类属于org.eclipse.jdt.junit.model包,在下文中一共展示了ITestCaseElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStoppedSessionFinishedWithFailingTest

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testStoppedSessionFinishedWithFailingTest() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  ITestRunSession testRunSession = mockTestRunSession( OK, testCaseElement );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );
  setTestCaseResult( testCaseElement, ERROR );
  testRunListener.testCaseFinished( testCaseElement );

  when( testCaseElement.getTestRunSession().getProgressState() ).thenReturn( STOPPED );
  testRunListener.sessionFinished( testCaseElement.getTestRunSession() );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "1 / 1", SWT.CENTER, errorColor(), 1, 1 );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:19,代码来源:JUnitTestRunListenerTest.java

示例2: testTestCaseFinished

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testTestCaseFinished() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  ITestRunSession testRunSession = mockTestRunSession( OK, testCaseElement );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );

  setTestCaseResult( testCaseElement, OK );
  testRunListener.testCaseFinished( testCaseElement );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "1 / 1", SWT.CENTER, successColor(), 1, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:19,代码来源:JUnitTestRunListenerTest.java

示例3: testOutOfOrderEvents

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testOutOfOrderEvents() {
  ITestCaseElement testCaseElement1 = mockTestCaseElement();
  ITestCaseElement testCaseElement2 = mockTestCaseElement();
  ITestRunSession testRunSession
    = mockTestRunSession( OK, testCaseElement1, testCaseElement2 );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );
  testRunListener.sessionFinished( testRunSession );
  setTestCaseResult( testCaseElement1, OK );
  testRunListener.testCaseFinished( testCaseElement1 );
  setTestCaseResult( testCaseElement2, OK );
  testRunListener.testCaseFinished( testCaseElement2 );
  testRunListener.sessionFinished( testRunSession );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "0 / 2", SWT.CENTER, successColor(), 0, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "1 / 2", SWT.CENTER, successColor(), 1, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "2 / 2", SWT.CENTER, successColor(), 2, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verifyNoMoreInteractions();
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:27,代码来源:JUnitTestRunListenerTest.java

示例4: testCaseFinished

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Override
public void testCaseFinished( ITestCaseElement testCaseElement ) {
  if( belongsToCurrentSession( testCaseElement ) ) {
    initializeCurrentSession( testCaseElement );
    currentSession.incExecutedTestCount();
    if( TestRunSessionInfo.isTestFailed( testCaseElement.getTestResult( false ) ) ) {
      currentSession.incFailedTestCount();
    }
    updateProgressUI( currentSession );
  }
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:12,代码来源:JUnitTestRunListener.java

示例5: collectCounters

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
private void collectCounters( ITestElementContainer testElementContainer ) {
  ITestElement[] children = testElementContainer.getChildren();
  for( ITestElement child : children ) {
    if( child instanceof ITestElementContainer ) {
      collectCounters( ( ITestElementContainer )child );
    }
    if( child instanceof ITestCaseElement ) {
      updateCounters( ( ITestCaseElement )child );
    }
  }
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:12,代码来源:TestRunSessionInfo.java

示例6: updateCounters

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
private void updateCounters( ITestCaseElement testElement ) {
  Result testResult = testElement.getTestResult( false );
  if( !UNDEFINED.equals( testResult ) ) {
    executedTestCount++;
  }
  if( isTestFailed( testResult ) ) {
    failedTestCount++;
  }
  totalTestCount++;
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:TestRunSessionInfo.java

示例7: testGetTotalTestCountWithTestCaseInChildren

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testGetTotalTestCountWithTestCaseInChildren() {
  setChildren( testRunSession, mock( ITestCaseElement.class ) );

  int count = testRunSessionInfo.getTotalTestCount();

  assertThat( count ).isEqualTo( 1 );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:9,代码来源:TestRunSessionInfoTest.java

示例8: testGetTotalTestCountWithTestCaseInNestedChilren

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testGetTotalTestCountWithTestCaseInNestedChilren() {
  ITestElementContainer nestedContainer = mock( ITestElementContainer.class );
  setChildren( nestedContainer, mock( ITestCaseElement.class ) );
  setChildren( testRunSession, nestedContainer );

  int count = testRunSessionInfo.getTotalTestCount();

  assertThat( count ).isEqualTo( 1 );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:TestRunSessionInfoTest.java

示例9: testStoppedSessionFinished

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testStoppedSessionFinished() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  ITestRunSession testRunSession = mockTestRunSession( OK, testCaseElement );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );

  when( testRunSession.getProgressState() ).thenReturn( STOPPED );
  testRunListener.sessionFinished( testCaseElement.getTestRunSession() );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:16,代码来源:JUnitTestRunListenerTest.java

示例10: testObsoleteSessionFinished

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testObsoleteSessionFinished() {
  ITestRunSession testRunSession1 = mockTestRunSession( OK, mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession1 );
  testRunListener.sessionStarted( testRunSession1 );
  ITestRunSession testRunSession2
    = mockTestRunSession( OK, mockTestCaseElement(), mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession2 );
  testRunListener.sessionStarted( testRunSession2 );
  setTestCaseResult( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ] );
  testRunListener.sessionFinished( testRunSession1 );
  setTestCaseResult( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ] );
  setTestCaseResult( ( ITestCaseElement )testRunSession2.getChildren()[ 1 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession2.getChildren()[ 1 ] );

  testRunListener.sessionFinished( testRunSession2 );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI).update( "0 / 2", SWT.CENTER, successColor(), 0, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI).update( "1 / 2", SWT.CENTER, successColor(), 1, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "2 / 2", SWT.CENTER, successColor(), 2, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verifyNoMoreInteractions();
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:35,代码来源:JUnitTestRunListenerTest.java

示例11: testTestCaseStarted

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testTestCaseStarted() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  mockTestRunSession( OK, testCaseElement );

  testRunListener.testCaseStarted( testCaseElement );

  verify( progressUI, never() )
    .update( anyString(), anyInt(), any( Color.class ), anyInt(), anyInt() );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:11,代码来源:JUnitTestRunListenerTest.java

示例12: testTestCaseFinishedWithFailure

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testTestCaseFinishedWithFailure() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  ITestRunSession testRunSession = mockTestRunSession( FAILURE, testCaseElement );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );
  setTestCaseResult( testCaseElement, FAILURE );

  testRunListener.testCaseFinished( testCaseElement );

  verify( progressUI ).update( "1 / 1", SWT.CENTER, errorColor(), 1, 1 );
  verify( progressUI ).setToolTipText( getToolTipText( testRunSession, 1 ) );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:14,代码来源:JUnitTestRunListenerTest.java

示例13: testTestCaseFinishedWithError

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testTestCaseFinishedWithError() {
  ITestCaseElement testCaseElement = mockTestCaseElement();
  ITestRunSession testRunSession = mockTestRunSession( FAILURE, testCaseElement );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );
  setTestCaseResult( testCaseElement, ERROR );

  testRunListener.testCaseFinished( testCaseElement );

  verify( progressUI ).update( "1 / 1", SWT.CENTER, errorColor(), 1, 1 );
  verify( progressUI ).setToolTipText( getToolTipText( testRunSession, 1 ) );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:14,代码来源:JUnitTestRunListenerTest.java

示例14: testSecondSessionLaunched

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testSecondSessionLaunched() {
  ITestRunSession testRunSession1 = mockTestRunSession( OK, mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession1 );
  testRunListener.sessionStarted( testRunSession1 );
  ITestRunSession testRunSession2
    = mockTestRunSession( OK, mockTestCaseElement(), mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession2 );
  testRunListener.sessionStarted( testRunSession2 );
  setTestCaseResult( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ] );
  setTestCaseResult( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ] );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "0 / 2", SWT.CENTER, successColor(), 0, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "1 / 2", SWT.CENTER, successColor(), 1, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verifyNoMoreInteractions();
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:28,代码来源:JUnitTestRunListenerTest.java

示例15: testRunTwoSessionsFromStartToEnd

import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Test
public void testRunTwoSessionsFromStartToEnd() {
  ITestRunSession testRunSession1 = mockTestRunSession( OK, mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession1 );
  testRunListener.sessionStarted( testRunSession1 );
  setTestCaseResult( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession1.getChildren()[ 0 ] );
  testRunListener.sessionFinished( testRunSession1 );
  ITestRunSession testRunSession2
    = mockTestRunSession( OK, mockTestCaseElement(), mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession2 );
  testRunListener.sessionStarted( testRunSession2 );
  setTestCaseResult( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession2.getChildren()[ 0 ] );
  setTestCaseResult( ( ITestCaseElement )testRunSession2.getChildren()[ 1 ], OK );
  testRunListener.testCaseFinished( ( ITestCaseElement )testRunSession2.getChildren()[ 1 ] );
  testRunListener.sessionFinished( testRunSession2 );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( "1 / 1", SWT.CENTER, successColor(), 1, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession1.getTestRunName() );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "0 / 2", SWT.CENTER, successColor(), 0, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "1 / 2", SWT.CENTER, successColor(), 1, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verify( progressUI ).update( "2 / 2", SWT.CENTER, successColor(), 2, 2 );
  order.verify( progressUI ).setToolTipText( testRunSession2.getTestRunName() );
  order.verifyNoMoreInteractions();
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:36,代码来源:JUnitTestRunListenerTest.java


注:本文中的org.eclipse.jdt.junit.model.ITestCaseElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。