Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. PrintingPageWebTester.assertTextPresent() has thrown an AssertionFailedError
    Unsorted
    0
    0
    0
  2. JUnit fail method
    JUnit
    94
    252
    97

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
junit.framework.AssertionFailedError: Expected text not found in current page: [The quick brown fox jumps over the lazy dog] Page content was: [[#COMNOTQWUS-1] Issue Summary - jWebTest JIRA installation Joe Test Administrator Update Status... Personal Space Profile Administration Log Out History Loading... Name of COMNOTQWUS Test View All Projects Issues Wiki Source Reviews Builds Dashboards Access more options (Alt+Shift+d) Issues Access more options (Alt+Shift+i) Agile Access more options Planning Board Task Board Chart Board Released Board Tempo Access more options Timesheet Worklogs Report About Tempo Administer project Quick Search Search Create new issue Keyboard Shortcuts Selected Project Name of COMNOTQWUS Name of COMNOTQWUS COMNOTQWUS-1 Issue Summary Edit - COMNOTQWUS-1Edit Assign Comment Log Work More ActionsMore Planning Board Task Board Log Work Attach Files Attach Screenshot Add Gliffy Diagram Voters Watch Issue Watchers Move Clone Labels Delete Start Progress Resolve Issue WorkflowMore Close Issue Views XML Word Printable Details Type: Bug Status: Open Priority: Major Resolution: Unresolved Affects Version/s: None Fix Version/s: None Component/s: None Labels: None Labels Activity All Comments Work Log History Activity Stream Transitions Source Reviews Builds There are no comments yet on this issue. Comment preview wiki markup help All Users Viewable by All Users Add Cancel Comment People Assignee: Joe Test Administrator Reporter: Joe Test Administrator Vote (0) Watch (0) Dates Created: Today 4:41 AM Updated: Today 4:41 AM Powered by JIRA Studio 104 | Terms of Use | Bug/feature request | Request Support | Help/Documentation | JIRA Studio Blog | Twitter @JIRAStudio]
    at junit.framework.Assert.fail(Assert.java:47)
    at net.sourceforge.jwebunit.junit.WebTester.assertTextPresent(WebTester.java:442)
    at com.atlassian.studio.livetest.PrintingPageWebTester.assertTextPresent(PrintingPageWebTester.java:144)
    at com.atlassian.studio.functest.tests.group1.TestCommitNotifications.testComment(TestCommitNotifications.java:63)

Solution

JaviRpo2 months ago

AssertionFailedError is thrown when using JUnit's internal assertions methods compare two different values and those are not equal. Also, the developer can invoke the method when the test logic fails.

The simplest code to reproduce the error is the following:

import static org.junit.Assert.fail;

public class FailTest { 

   @Test 
   public void shouldAssertStrings() { 
      ...
      if( ... ) {
         fail("Any message");
      }
   } 
}

Mind the static import. The fail is part of the JUnit API.

External results for this pattern (10)

  1. Dawid Loubservia Google Groups1 week ago
    expected:<1> but was:<0>
    Show stack trace
  2. Dawid Loubservia Google Groups1 week ago
    null
    Show stack trace
  3. El Deffovia Google Groups1 week ago
    null
    Show stack trace
  4. Maxime Gréauvia JIRA1 week ago
    Expected: <null> but was: file:/srv/ciagent/workspace/target/test-classes/repo/MyClass.groovy
    Show stack trace
  5. Franz Willervia JIRA1 week ago
    Created Document not found! uid:create.test.1.3
    Show stack trace
  6. shinsuke-matvia GitHub2 weeks ago
    Expecting IllegalArgumentException - non-bracketing
    Show stack trace
  7. No message found for this stack trace.
    Show stack trace
  8. aarthipavia GitHub1 month ago
    expected:<982007015> but was:<1232306490>
    Show stack trace
  9. lewismcvia GitHub2 months ago
    Validation of file succeeded when it should have failed expected:<false> but was:<true>
    Show stack trace
  10. vijjusreevia GitHub2 months ago
    Query result size expected:<2> but was:<1>
    Show stack trace