Am new to Selenium and a java handicap. I read through and tried to perform my first selenium test in Java using JUnit framework. No success yet. Please can you help with steps in detail assuming I don't how to set the classpath even (not really).
Thanks in advance.
Below is my code.
//package com.example.tests;
import com.thoughtworks.selenium.*;\\ import junit.framework.*;\\ import java.util.regex.Pattern;
public class GoogleTest extends SeleneseTestCase {\\ public void setUp() throws Exception {\\ setUp("[
http://www.google.com/]", "*chrome");\\ }\\ public void GoogleTestSRC() throws Exception {\\ selenium.open("/");\\ assertEquals("Google", selenium.getTitle());\\ selenium.type("q", "Selenium RC help");\\ selenium.click("btnI");\\ selenium.waitForPageToLoad("30000");\\ assertEquals("Google", selenium.getTitle());\\ }\\ public static Test suite() {\\ return new TestSuite(GoogleTest.class);\\ }\\ public void tearDown(){\\ selenium.stop();\\ }\\ public static void main(String args[]) {\\ junit.textui.TestRunner.run(suite());\\ }\\ }
Which gives me the following result:
C:\selenium-RC\selenium-java>javac GoogleTest.java
C:\selenium-RC\selenium-java>java GoogleTest\\ Exception in thread "main" java.lang.NoClassDefFoundError: GoogleTest\\ Caused by: java.lang.ClassNotFoundException: GoogleTest\\ at java.net.URLClassLoader$1.run(Unknown Source)\\ at java.security.AccessController.doPrivileged(Native Method)\\ at java.net.URLClassLoader.findClass(Unknown Source)\\ at java.lang.ClassLoader.loadClass(Unknown Source)\\ at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)\\ at java.lang.ClassLoader.loadClass(Unknown Source)\\ at java.lang.ClassLoader.loadClassInternal(Unknown Source)\\ Could not find the main class: GoogleTest. Program will exit.
C:\selenium-RC\selenium-java>
Request your help to know the do's and don't of selenium.
Regards,
Khasim.