We help IT Professionals succeed at work.
Get Started

JUnit, Assertion Failed Error

855 Views
Last Modified: 2013-12-15
Hi there,

Using Eclipse I'm writing a program to test web pages in Java, with JUnit and HttpUnit.
I'm trying to click on a submit button (button1) inside a table cell. But when I use assert to make sure the button is there I get this message:

pageException in thread "main" junit.framework.AssertionFailedError: expected:<Search for Projects & Documents> but was:<Submit with cmdSearch=Search for Projects & Documents>

The actual value doesn't make any sense to me, what I read from the message is not what  I see in the HTML source of the web page.
I attach both my java code and the HTML source. Please have a look at the line in my java code where I'm creating the variable button1, because the error message comes from the line after that.

Thank you,

Ana  
HTML-PUBLIC.docx
package-secondTrial.doc
Comment
Watch Question
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE