Package hudson.tasks.test

Examples of hudson.tasks.test.TestResult


        AbstractTestResultAction<?> testResults = mock( AbstractTestResultAction.class );
        when( testResults.getFailCount() ).thenReturn( 2 );

        List<TestResult> failedTests = new ArrayList<TestResult>();
        for(int i = 0; i < 2; i++) {
            TestResult result = mock( TestResult.class );
            when( result.isPassed() ).thenReturn( false );
            when( result.getFullName() ).thenReturn( "hudson.plugins.emailext.ExtendedEmailPublisherTest" );
            when( result.getDisplayName() ).thenReturn( "Test" + i );
            when( result.getErrorDetails() ).thenReturn( "Error" + i );
            when( result.getErrorStackTrace() ).thenReturn( "Stack" + i );
            failedTests.add(result);
        }
       
        Mockito.<List<? extends TestResult>>when( testResults.getFailedTests() ).thenReturn( failedTests );       
        when( build.getAction(AbstractTestResultAction.class) ).thenReturn( testResults );
View Full Code Here


        AbstractTestResultAction<?> testResults = mock( AbstractTestResultAction.class );
        when( testResults.getFailCount() ).thenReturn( 2 );

        List<TestResult> failedTests = new ArrayList<TestResult>();
        for(int i = 0; i < 2; i++) {
            TestResult result = mock( TestResult.class );
            when( result.isPassed() ).thenReturn( false );
            when( result.getFullName() ).thenReturn( "hudson.plugins.emailext.ExtendedEmailPublisherTest" );
            when( result.getDisplayName() ).thenReturn( "Test" + i );
            when( result.getErrorDetails() ).thenReturn( "Error" + i );
            when( result.getErrorStackTrace() ).thenReturn( "Stack" + i );
            failedTests.add(result);
        }
        Mockito.<List<? extends TestResult>>when( testResults.getFailedTests() ).thenReturn( failedTests );
        when( build.getAction(AbstractTestResultAction.class) ).thenReturn( testResults );
View Full Code Here

        AbstractTestResultAction<?> testResults = mock( AbstractTestResultAction.class );
        when( testResults.getFailCount() ).thenReturn( 2 );

        List<TestResult> failedTests = new ArrayList<TestResult>();
        for(int i = 0; i < 2; i++) {
            TestResult result = mock( TestResult.class );
            when( result.isPassed() ).thenReturn( false );
            when( result.getFullName() ).thenReturn( "hudson.plugins.emailext.ExtendedEmailPublisherTest" );
            when( result.getDisplayName() ).thenReturn( "Test" + i );
            when( result.getErrorDetails() ).thenReturn( "Error" + i );
            when( result.getErrorStackTrace() ).thenReturn( "Stack" + i );
            failedTests.add(result);
        }
        Mockito.<List<? extends TestResult>>when( testResults.getFailedTests() ).thenReturn( failedTests );
        when( build.getAction(AbstractTestResultAction.class) ).thenReturn( testResults );
View Full Code Here

        AbstractTestResultAction<?> testResults = mock( AbstractTestResultAction.class );
        when( testResults.getFailCount() ).thenReturn( 2 );

        List<TestResult> failedTests = new ArrayList<TestResult>();
        for(int i = 0; i < 2; i++) {
            TestResult result = mock( TestResult.class );
            when( result.isPassed() ).thenReturn( false );
            when( result.getFullName() ).thenReturn( "hudson.plugins.emailext.ExtendedEmailPublisherTest" );
            when( result.getDisplayName() ).thenReturn( "Test" + i );
            when( result.getErrorDetails() ).thenReturn( "Error" + i );
            when( result.getErrorStackTrace() ).thenReturn( "Stack" + i );
            failedTests.add(result);
        }
        Mockito.<List<? extends TestResult>>when( testResults.getFailedTests() ).thenReturn( failedTests );
        when( build.getAction(AbstractTestResultAction.class) ).thenReturn( testResults );
View Full Code Here

        AbstractTestResultAction<?> testResults = mock( AbstractTestResultAction.class );
        when( testResults.getFailCount() ).thenReturn( 5 );

        List<TestResult> failedTests = new ArrayList<TestResult>();
        for(int i = 0; i < 5; i++) {
            TestResult result = mock( TestResult.class );
            when( result.isPassed() ).thenReturn( false );
            when( result.getFullName() ).thenReturn( "hudson.plugins.emailext.ExtendedEmailPublisherTest" );
            when( result.getDisplayName() ).thenReturn( "Test" + i );
            when( result.getErrorDetails() ).thenReturn( StringUtils.leftPad( "", 3 * 1024, 'z' ) );
            when( result.getErrorStackTrace() ).thenReturn( StringUtils.leftPad( "", 200, 'e' ) );
            failedTests.add(result);
        }

        Mockito.<List<? extends TestResult>>when( testResults.getFailedTests() ).thenReturn( failedTests );
        when( build.getAction(AbstractTestResultAction.class) ).thenReturn( testResults );
View Full Code Here

    public List<TestResult> getList(int start, int end) {
      List<TestResult> list = new ArrayList<TestResult>();
      end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
      for (AbstractBuild<?,?> b: testObject.getOwner().getParent().getBuilds().subList(start, end)) {
        if (b.isBuilding()) continue;
        TestResult o = testObject.getResultInBuild(b);
        if (o != null) {
          list.add(o);
        }
      }
      return list;
View Full Code Here

    }

    @Override
    public ClassResult getPreviousResult() {
        if(parent==null)   return null;
        TestResult pr = parent.getPreviousResult();
        if(pr==null)    return null;
        if(pr instanceof PackageResult) {
            return ((PackageResult)pr).getClassResult(getName());
    }
        return null;
View Full Code Here

        Map<String, TestResult> failedTestsByName = new HashMap<String, hudson.tasks.test.TestResult>();
        for (TestResult r: failingTests) {
            failedTestsByName.put(r.getName(), r)
        }
        assertTrue("we've got the expected failed test", failedTestsByName.containsKey(EXPECTED_FAILING_TEST_NAME));
        TestResult firstFailedTest = failedTestsByName.get(EXPECTED_FAILING_TEST_NAME);
        assertFalse("should not have passed this test", firstFailedTest.isPassed());
       
        assertTrue(firstFailedTest instanceof CaseResult);
        CaseResult firstFailedTestJunit = (CaseResult)firstFailedTest;
        assertEquals(EXPECTED_FAILING_TEST_CLASSNAME, firstFailedTestJunit.getClassName());
View Full Code Here

  }
 
  @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
  public void testUrlShouldBeUrlEncoded() {
      TestResult result = mock(TestResult.class);
      AbstractBuild build = mock(AbstractBuild.class);
      when(build.getUrl()).thenReturn("/a build");
     
      AbstractTestResultAction action = mock(AbstractTestResultAction.class);
      when(action.getUrlName()).thenReturn("/action");
     
      when(result.getOwner()).thenReturn(build);
      when(result.getTestResultAction()).thenReturn(action);
      when(result.getUrl()).thenReturn("/some id with spaces");
     
      String testUrl = MessageHelper.getTestUrl(result);
      assertEquals("null/a%20build/action/some%20id%20with%20spaces", testUrl);
  }
View Full Code Here

    public List<TestResult> getList(int start, int end) {
      List<TestResult> list = new ArrayList<TestResult>();
      end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
      for (AbstractBuild<?,?> b: testObject.getOwner().getParent().getBuilds().subList(start, end)) {
        if (b.isBuilding()) continue;
        TestResult o = testObject.getResultInBuild(b);
        if (o != null) {
          list.add(o);
        }
      }
      return list;
View Full Code Here

TOP

Related Classes of hudson.tasks.test.TestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.