Running Github Java Files

25 views
Skip to first unread message

simon drake

unread,
Mar 24, 2015, 3:22:46 PM3/24/15
to jenkins...@googlegroups.com
Good afternoon,

Apologies if this is a very Rookie question but I have searched far and wide and haven't been able to find anything of use. I am currently writing JUnit Selenium WebDriver tests, using Eclipse, and then 'committing' to a private Github repository.

I cannot seem to find any instructions/documentation on how to create a Jenkins job which will run the required.java files from Github?

If anybody could help I would be most grateful!

Regards,
Si

Ginga, Dick

unread,
Mar 24, 2015, 4:27:03 PM3/24/15
to jenkins...@googlegroups.com
I have done this just once. SCM should not matter. Using Eclipse, export to an ant build.xml file. Commit that file.
 
Pull down test sources build and run tests. These were my command lines:
 
call "C:\apache-ant-1.9.4\bin\ant.bat" -file build.xml build
 
call "C:\apache-ant-1.9.4\bin\ant.bat" -file build.xml Suite1Runner
 
and these post-build steps to publish:
 
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
 

simon drake

unread,
Mar 24, 2015, 4:29:56 PM3/24/15
to jenkins...@googlegroups.com
Sorry what is SCM? Also I've not used Ant build files - I've heard of maven; are these similar?

I'm completely confused now :-)

Ginga, Dick

unread,
Mar 24, 2015, 4:34:32 PM3/24/15
to jenkins...@googlegroups.com
SCM- any Source Code Management system - we use Perforce

Ant is a build scripting language. In Eclipse: File->Export->General->Ant Build Files

-----Original Message-----
From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of simon drake
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/433bd9fc-41f1-4bf5-b88c-f708d0d009fc%40googlegroups.com.

simon drake

unread,
Mar 24, 2015, 5:01:17 PM3/24/15
to jenkins...@googlegroups.com
I've not heard of source code management; something to research :-)

I'll give this all a go tomorrow, thank you!

simon drake

unread,
Mar 25, 2015, 6:48:04 AM3/25/15
to jenkins...@googlegroups.com
I've just realised that SCM is GitHub (in your case Perforce) - clearly I was in a sleep deprived state last night and was having a stupid moment!

simon drake

unread,
Mar 25, 2015, 7:00:28 AM3/25/15
to jenkins...@googlegroups.com
Sorry - I've looked into Ant quite a lot this morning but I'm still not 100% what it is or what it does!?

So my setup (currently) is as follows:

JUnit Code (Eclipse) --> Github (Private Repo) --> Jenkins

I have actually been able to get the job to run on Jenkins, through GitHub by doing the following (which I was able to copy and paste but don't understand what it's doing....)

Source Code Management: Git
Add in URL/Credentials

Branches to build: */master

Execute Windows batch command:
cd C:\Jenkins\workspace\{RepoName}\src
set CLASSPATH=.;%CLASSPATH%;C:\SeleniumJars\junit-4.11.jar;C:\SeleniumJars\selenium-server-standalone-2.45.0.jar
javac
{classname}.java
java org
.junit.runner.JUnitCore {classname}


I now know of Maven/Ant but I don't know a lot about them at all - if there is a better way to integrate these systems I'd be most welcome if someone could tell me :-)



Ginga, Dick

unread,
Mar 25, 2015, 8:32:38 AM3/25/15
to jenkins...@googlegroups.com

There is nothing wrong with your approach below. Figure out where the junit test results are being placed and you can use the publish junit plugin to create a nice chart on the build page.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

simon drake

unread,
Mar 27, 2015, 9:27:18 AM3/27/15
to jenkins...@googlegroups.com
Thanks rginga,

The problem is I don't understand what it's doing so it's difficult to tailor/change it to work how I want :-)

Regarding the JUnit test results; there are on github and I know the repo structure; is that what you mean?

Ginga, Dick

unread,
Mar 27, 2015, 9:40:49 AM3/27/15
to jenkins...@googlegroups.com

Simon, Sorry if this is really basic stuff but I’m just trying to help:

 

Your build job first pulls the sources from Github. Now forget about Github, your build is running on the Jenkins master in the folder

 

C:\Jenkins\workspace\

 

I am assuming your batch file commands do what you want. I run nUnit tests not jUnit tests. After your batch file runs, there should be some jUnit test results file somewhere in

 

C:\Jenkins\workspace\

 

Find them, then add a post-build step to publish them

Reply all
Reply to author
Forward
0 new messages