java - How to execute Selenium 2 tests in Jenkins -
i able use selenium 2 jenkins.
i new both please excuse of ignorance.
i noticed following plugin jenkins here, , installed it.
i have base class follows:
public class basetestclass { protected properties myprops; protected string baseurl; protected webdriver driver; protected boolean acceptnextalert = true; protected stringbuffer verificationerrors = new stringbuffer(); public basetestclass() { try { myprops = testutil.readprops("src/myprops.properties"); baseurl = myprops.getproperty("baseurl"); driver = new remotewebdriver(new url("http://localhost:4444/wd/hub"), desiredcapabilities.firefox()); } catch(exception e) { e.printstacktrace(); } } @before public void setup() throws exception { driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } @after public void teardown() throws exception { driver.quit(); string verificationerrorstring = verificationerrors.tostring(); if (!"".equals(verificationerrorstring)) { fail(verificationerrorstring); } } protected boolean iselementpresent(by by) { try { driver.findelement(by); return true; } catch (nosuchelementexception e) { return false; } } protected string closealertandgetitstext() { try { alert alert = driver.switchto().alert(); if (acceptnextalert) { alert.accept(); } else { alert.dismiss(); } return alert.gettext(); } { acceptnextalert = true; } }
i have following configuration on selenium plugin jenkins :
..
once try build project , run junit selenium test in jenkins, builds successfully, test self fails. (works fine when running ant command line - , changing webdriver
: driver = new firefoxdriver();
) - using selenium rc
this console output in jenkins:
edit: noticed can archive junit .xml output file after build in jenkins. getting class not found exception? weird because said, builds fine when using ant
command line.
the error follows:
<error message="com.loggedin.ccbreadcrumb" type="java.lang.classnotfoundexception"> java.lang.classnotfoundexception: com.loggedin.ccbreadcrumb @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:423) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:356) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:186) </error>
thanks in advance direction or may have!
i think making several mistakes. resolve class not found exception
added following ant's build.xml
- (remember new ant)
<target name="compile" depends="init" description="compile source " > <javac srcdir="src/" destdir="bin" classpathref="seleniumcc.classpath"/> </target>
this got java classes compiling.
then had update selenium standalone server latest version (selenium-server-standalone-2.xx.x.jar
) located in:
jenkins_home_directory\plugins\selenium\web-inf\lib
last trying use wrong configuration in selenium plug-in (i trying use custom rc node configuration, needed custom web driver node configuration.)
also note : when running selenium server on red hat had setup , install xvfb jenkins xvfb plugin.
i hope can of others in future! luck!
Comments
Post a Comment