Re: [selenium-users] method assertEquals (String, String) is undefined for the type....

2,893 views
Skip to first unread message

jyoti gautam

unread,
Oct 8, 2012, 8:29:08 AM10/8/12
to seleniu...@googlegroups.com

Hi Bert,

Have you imported the "org.junit.*" package? I guess if u import this package in the code where you are writing the code the error wont come.


Jyoti


On Mon, Oct 8, 2012 at 4:59 PM, bert <stevejba...@gmail.com> wrote:
Forgive a beginners question but, I'm working my way through the Alan Richardson Selenium Simplified book.  I've got to an exercise where I'm asked to record an IDE script which should include asserting the page title.  The book hasn't covered assert page title; though I've found the command and added to the script.  When I export the code as Java/Junit RC and paste into Eclipse, I get the following error:-

   The method assertEquals (String, String) is undefined for the type MyFirstSetOfExercises

The first option on clicking the error:

   Add static import 'org.junit.Assert.*'

The offending line is:

  assertEquals("website - Selenium Simplified Search Engine", selenium.getTitle());

Is there an error in the syntax for the assert command here or do I need to import / point to a different package?

Again, sorry for what is no doubt an obvious problem but anyone who can elaborate would be much appreciated.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/1QGNPQrtPgsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

niharika varshney

unread,
Nov 6, 2012, 3:55:32 AM11/6/12
to seleniu...@googlegroups.com
You can add
import static org.junit.Assert.*; to your imports.
If you see a suggestion in eclipse, you can select it to perform the suggested action.

Regards,
N

On Tue, Nov 6, 2012 at 11:41 AM, balajee naidu <balajee.k...@gmail.com> wrote:
What is the soultion for this error ?
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/hHcM_uFMOJgJ.
Reply all
Reply to author
Forward
0 new messages