How to test a given Junit in Jenkins
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.
java jenkins junit
add a comment |
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.
java jenkins junit
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 --> stackoverflow.com/questions/2235276/… 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
add a comment |
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.
java jenkins junit
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.
java jenkins junit
java jenkins junit
edited Nov 21 '18 at 12:01
StudEH
asked Nov 21 '18 at 10:31
StudEHStudEH
124
124
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 --> stackoverflow.com/questions/2235276/… 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
add a comment |
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 --> stackoverflow.com/questions/2235276/… 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
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 --> stackoverflow.com/questions/2235276/… 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
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 --> stackoverflow.com/questions/2235276/… 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
I added some new info since i appearently downloaded just 1 file instead of the entire project.
– StudEH
Nov 21 '18 at 12:02
add a comment |
1 Answer
1
active
oldest
votes
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"
}
}
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410107%2fhow-to-test-a-given-junit-in-jenkins%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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"
}
}
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
add a comment |
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"
}
}
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
add a comment |
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"
}
}
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"
}
}
answered Nov 21 '18 at 13:25
Suryavel TRSuryavel TR
2,47311420
2,47311420
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
add a comment |
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
I fixed it already but this is basicly what i did yes
– StudEH
Nov 22 '18 at 8:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410107%2fhow-to-test-a-given-junit-in-jenkins%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

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 --> stackoverflow.com/questions/2235276/… 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