本文整理汇总了Java中org.eclipse.jdt.junit.model.ITestCaseElement类的典型用法代码示例。如果您正苦于以下问题:Java ITestCaseElement类的具体用法?Java ITestCaseElement怎么用?Java ITestCaseElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITestCaseElement类属于org.eclipse.jdt.junit.model包,在下文中一共展示了ITestCaseElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: JUnitExecution
import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
/** Constructor. */
public JUnitExecution(ITestElement test, JUnitExecution parent) {
double elapsedTime = test.getElapsedTimeInSeconds();
if (parent == null) {
// Avoids potential NPE by making this JUnitExecution its own parent
// for the scope of the constructor.
parent = this;
}
if (elapsedTime > 0.0) {
duration = new JsonifiedDouble(elapsedTime);
}
setResult(test.getTestResult(true));
if (test instanceof ITestRunSession) {
ITestRunSession session = (ITestRunSession) test;
// FIXME (MMB) is test class name, but redundant! Can be replaced by
// project name
setProjectNameHash(session.getTestRunName());
}
if (test instanceof ITestCaseElement) {
ITestCaseElement testElement = (ITestCaseElement) test;
testMethodHash = WatchDogUtils
.createHash(testElement.getTestMethodName());
parent.setClassNameHash(testElement.getTestClassName());
} else if (test instanceof ITestElementContainer) {
ITestElementContainer testContainer = (ITestElementContainer) test;
childrenExecutions = createTree(testContainer);
}
}
开发者ID:TestRoots,项目名称:watchdog,代码行数:33,代码来源:JUnitExecution.java
示例17: convertResultStatus
import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
private static PluginTestResult.Status convertResultStatus(ITestCaseElement.Result testCaseElementResult) {
if (testCaseElementResult.equals(ITestCaseElement.Result.OK)) {
return PluginTestResult.Status.OK;
}
else if (testCaseElementResult.equals(ITestCaseElement.Result.IGNORED)) {
return PluginTestResult.Status.Ignored;
}
else {
return PluginTestResult.Status.Failed;
}
}
开发者ID:chrrasmussen,项目名称:NTNU-Master-Project,代码行数:12,代码来源:AkkaTestRunListener.java
示例18: testCaseFinished
import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
@Override
public void testCaseFinished(ITestCaseElement testCaseElement) {
double elapsedTimeInSeconds = testCaseElement.getElapsedTimeInSeconds();
ClientRecorder clientRecorderInstance = COPEPlugin.getDefault()
.getClientRecorder();
clientRecorderInstance.recordTestRun(testCaseElement.getTestClassName()
+ "." + testCaseElement.getTestMethodName(), testCaseElement
.getTestResult(true).toString(), elapsedTimeInSeconds);
}
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:10,代码来源:JUnitListener.java
示例19: testCaseFinished
import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
/***
* After each test case see if it failed, if it fails set
* this.allTestPassed to false to indicate that Tested Plugin should
* not make any analysis yet.
*
* See Github issue number 4.
* https://github.com/christofferholmstedt/eclipse-plugin-tested/issues/4
*/
@Override
public void testCaseFinished(ITestCaseElement testCaseElement)
{
if (testCaseElement.getTestResult(false) != Result.OK)
{
this.allTestPassed = false;
}
}
开发者ID:christofferholmstedt,项目名称:eclipse-plugin-tested,代码行数:17,代码来源:TestedTestRunListener.java
示例20: mockTestCase
import org.eclipse.jdt.junit.model.ITestCaseElement; //导入依赖的package包/类
private static ITestCaseElement mockTestCase( Result testResult ) {
ITestCaseElement result = mock( ITestCaseElement.class );
when( result.getTestResult( false ) ).thenReturn( testResult );
return result;
}
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:6,代码来源:TestRunSessionInfoTest.java
注:本文中的org.eclipse.jdt.junit.model.ITestCaseElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论