Jenkins Inegration with TestNG.(when running from jenkins it's not invoking browser) - maven

My project contains (Webdriver,Maven3.05,jenkins) when I run maven command "mvn test" , test will trigger and browser will be invoked, the same set when i had configured using jenkins it will run the tests but browser will not be invoked.Please help me where iam going wrong.(I had installed testng plugin for jenkins all necessary configurations are taken care).

Try starting jenkins using the command line:
java -jar jenkins.war
Usually in Windows not all the services are allowed to use the interface
Hope helps!

Related

execute command mvn clean install failed when integrate with Jenkins

I try to build Jenkins with maven project and in goal I defined: clean install.
But it failed with the below reason:
I try to execute the command mvn clean install in command line but it works fine even with eclipse IDE.
I also check the network and see I can connect successfully.
Any solution in this case.
By default, Jenkins can't access the internet if you are under Proxy. So please configure proxy in jenkins. Here I am attaching a link to configure the jenkins. Hope this helps. If anything comes up, please comment below.

How to integrate maven framework with Jenkins

In order to integrate and run the Selenium Maven project on Jenkins 2.73.3, I set the option(s) as the following images:
Notice Goals and options with clean install; nothing else selected/checked, but Enable triggering of downstream projects.
Notice Install automatically is unchecked.
Jenkins project built successfully without opening any browser that shows any activity.
Please, let me know if there is/are any project setting(s) to solve this issue; i.e.: can we see the Web application run on browser as it does when it's run by the Maven project.
You are using Jenkins from services means you are using installable Jenkins version which not allow opening of any UI invocation.
You need to use jenkins.war
You can download war from below URL:
https://updates.jenkins-ci.org/download/war/
Use below command to start Jenkins server
java -jar jenkins.war --httpPort=9090

Make Jenkins Build a SUCCESS After successful Spring-boot run

I have CI system using Jenkins that automatically clones a repository,
then runs mvn clean install and then mvn spring-boot:run (using windows batch).
My problem is that the Jenkins Build does not stop even though the spring-boot:run is successful.
Is there any way to work this out?
I found a workaround for this.
I added a Build Step that executes a Windows Batch file as a child process
but before starting the batch process, I changed the BUILD_ID to something like BUILD_ID='NO_DELETE' so that Jenkins won't automatically kill it.

How do I call Junit test (Rest call) cases after deploy war in tomcat through Jenkins?

I am doing continues deployment of my Project war through Maven(Build tool), jenkins(CD tool) and SVN as version control.
I am able deploy war to tomcat , now i want to run some junit which call's Rest web services to that deployed jar, how would jenkins do it ?
You can do this via "execute shell" in jenkins. Firstly, you can check whether "execute shell" is been installed in your jenkins or not it comes as a add-on. If you have shell, you can write a small piece of code to execute your code. Remember this code will be executed on the jenkins slave box which has used to deploy your war.
Start jar file : java -jar .jar
2 ways to do that :
A) mvn exec:exec -Dexec.args="arg1" (this needs maven to be installed on the jenkins box), call you test case directly. Remember before running you should be in directory path.
For example :
cd ${HOME}/(code directory which you want to navigate to in order to run command) - Here HOME is /home/jenkinsUser
Now you are the location(although the first step is optional, you can run without navigating to the location), from where you want to run your unit test case. You can run them as a java command from there, passing the parameter to the deployed jar.

Issue on Running JUnit Selenium tests in Jenkins

I'm beginner by using Selenium and Jenkins. So here is my problem.
I got on a Linux VM, jenkins which is installed and got plugins : JUnit attachment and filesystem_SCM.
I got in a folder of that VM the java files containing my selenium tests.
I would to execute from jenkins those scripts executing on a windows machine where Selenium RC is turning on.
How could I do that ? I've seen Selenium grid plugin or just tried to create a job with a shell command containing mvn instruction but I don't really understand what to do ? Does someone could help me ?
What I believe you'll want to do is to configure a Windows Machine (VMs are terrific for this) as a Selenium Slave machine and then have your tests executed there. In this scenario, your Jenkins Master (the linux VM) would trigger the slave (the windows VM) to execute the build.
In Jenkins you can do this by having the Slave execute your build that runs the tests via JUnit. You can either configure executing the tests as a separate build in Jenkins, or simply as a build step in your main build.
Here's some relevant Links:
Jenkins Distributed Builds
Setting up Master and Slave Machines in Jenkins

Resources