0

So they gave me a Jenkins buildserver and a Junit test with an empty method just to see if we can run the test. Now those are the only 2 things i got, i'm confused on how i'm supposed to test this junit. Whenever i search something about it almost the only thing that pops up is Maven where you have to make a project, next you upload your project to Jenkins...

Since I don't have a project only a junit test, is there a way to test this file by itself?

Edit: I appearently i selected the wrong download for the files and only downloaded 1 instead of the entire project. The project is a Maven project it seems.

StudEH
  • 15
  • 1
  • 6
  • Is your project using build tool like gradle ? if so you have to execute this in your jenkins job `./gradlew test`. if not refer this --> https://stackoverflow.com/questions/2235276/how-to-run-junit-test-cases-from-the-command-line on how to use execute test using junit jar. Make sure your system on which jenkins is has all the required things installed like java. – Suryavel TR Nov 21 '18 at 10:38
  • I added some new info since i appearently downloaded just 1 file instead of the entire project. – StudEH Nov 21 '18 at 12:02

1 Answers1

0

I hope your Jenkinsfile contains all other script from cloning repo to setting up other dependencies. After checking-out the repo, run mvn test

Jenkinsfile

node {
 stage("Test") {
   sh "mvn test"
  }
}
Suryavel TR
  • 3,576
  • 1
  • 22
  • 25