I'm new to Selenium.
This will be a guide for me: the 'above novice programmer' and 'below dev'.
Starting Assumptions
Java jre is installed.
Class path for Java has been set up.
You know how to add/edit class paths (for most (all?) Windows machines this is: Start > right click My Computer > Properties > Advanced tab > Environment Variables)
Class path for Java has been set up.
You know how to add/edit class paths (for most (all?) Windows machines this is: Start > right click My Computer > Properties > Advanced tab > Environment Variables)
There is a Selenium project kicking around, already set up with TestNG.
We're on a Windows computer.
I'm going to assume that you've been able to run these from your IDE - in my case, Eclipse. For help on this, or getting TestNG set up originally, refer to my older post on Implementing TestNG.
I'm going to assume that you've been able to run these from your IDE - in my case, Eclipse. For help on this, or getting TestNG set up originally, refer to my older post on Implementing TestNG.
What two things we need to set up
Two classpaths are required. Please be aware that a computer reboot is required in order for a class path / environment variable to be set.
So I add in to my class path
c:\Selenium\*
From memory I think this didn't work without the \* - I can't really be bothered analysing why, or double checking this.
Class path to Selenium jar
So I have a file on my computer: C:\Selenium\selenium-server-standalone-2.25.0.jarSo I add in to my class path
c:\Selenium\*
From memory I think this didn't work without the \* - I can't really be bothered analysing why, or double checking this.
Class path to my project
And I have a project at C:\dev\Workspace\MyProject\
So I will add the bin to my class path
C:\dev\Workspace\MyProject\bin;
This seemed to throw a wobbly when I added \* ..again, I am a bit perplexed but can't really justify analysing why, or double checking this. So I will add the bin to my class path
C:\dev\Workspace\MyProject\bin;
Command to Run
Refer to the official documentation for examples on creating a driving xml file.
C:\Selenium\DrivingXml>java org.testng.TestNG myDrivingXmlFile.xml
Work log (and issues encountered)
Could not find or load main class org.testng.TestNG
Check your class paths. I had this because I failed to include my class path to my selenium jar. Or had an error in one of my class paths.Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNG
Computer probably doesn't hvae TestNG jar file. Will test this on Monday though as today is POETS day.
No comments:
Post a Comment