Why does Jenkins change my workspace path? - eclipse

i have installed Jenkins on Windows 10 and each time i try to execute a maven project or just try to execute mvn clean test (command line), Jenkins decides that my new workspace should be: C:\Windows\system32\config\systemprofile\eclipse-workspace\ while my project is in C:\Users\username\eclipse-workspace.
Jenkins starts in the directory C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\projectName and even if i run a cd command i will have this problem:
The driver executable must exist:
C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
My chrome driver is not there obviously but it's in C:\Users\userName\eclipse-workspace\projectName\drivers\chromedriver.
It looks like than Jenkins changes my user.home.
I went to config file and set:
<workspaceDir>C:\Users\userName\eclipse-workspace</workspaceDir>
but it's still looking for the driver in C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
This part: C:\Windows\system32\config\systemprofile\ is obtained using in Java System.getProperty("user.home"). Running it with Jenkins seems to modify it.
Why is it looking for my driver there?
Why can't it just stick to my workspace folder?
How can i solve this?
Thank you

I think i solved it. I was running under Local System Account
https://jenkins-le-guide-complet.github.io/html/sect-windows-service.html#fig-hudson-windows-service-config
I had edit the service as shown in the link.

Related

Executing Karate scenarios calling external JAR from VScode

I use Karate as standalone JAR, and for writing scenarios I've installed Visual Source Code with the "karate-runner" plugin as IDE support.
I use an external jar for encryption treatments.
The trouble is that, when I execute a Karate scenario from Visual Source Code (for debuggig purpose), my external jar is not taken into account, and during execution, I get the message "java.lang.ClassNotFoundException: GenerateSign" in the console.
I've no problem when I launch the scenario directly in command line like :
Karate.bat mytest.feature
With the content of karate.bat is :
java -cp karate.jar;Sign.jar;. com.intuit.karate.Main %*
So, how to configure the tools in order to execute my karate scenarios from VScode taking into account my external jar too?
Thanks a lot.
I suspect the problem is you haven't updated the "karateCli" property in your launch.json debug configuration. Can you try to update it including your additional jar file and try again.
EDIT
Based on what command line does work in your batch file you should update your "Karate Runner" extensions settings as shown below in the images.
For running tests from Codelens with "Run Karate Test(s)"
For running tests with VSCode debugger
Maybe you simply are on the wrong version. Dir you try 0.9.5 ?
Here are the instructions: https://marketplace.visualstudio.com/items?itemName=kirkslota.karate-runner
For those coming across this in the future, you can use this as an additional reference: https://github.com/intuit/karate/wiki/Karate-Robot-Windows-Install-Guide

FAIL - Failed to deploy application at context path

Before I explain the problem, I just want to point out that I am completely new to NetBeans and Tomcat and I am doing a school project. That being said, the problem is exactly what the title says. Here is the output when I try to run a simple Hello World jsp:
In-place deployment at
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\build\web
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Flostl%2FAppData%2FLocal%2FTemp%2Fcontext7180600714574256491.xml&path=/Project3
FAIL - Failed to deploy application at context path [/Project3]
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\nbproject\build-impl.xml:1058: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 0 seconds)
I am using Apache NetBeans 11.2 and Tomcat 9 if it is relevant.
Here is what I tried:
I checked the server log and it displays absolutely nothing.
I tried setting the context path directly to Project3 (i.e. including the -C:/... before Project3) in the context.xml file under META-INF folder.
I tried restarting NetBeans and cleaning and building the project.
I tried running NetBeans under admin privileges.
I might seem like such an idiot for not knowing how to fix this since no one else seems to have this problem, but please help me out.
If you have installed the Apache Tomcat appart from Netbeans, maybe your apache service is already running and it conflicts with Netbeans. You may stop the apache service and then run the application in Netbeans.
Because Netbeans start the apache service in a diffent way, so you don´t need to install the aplication on apache´s folder.
Check out the Windows Services (Services App) and stop the Apache Tomcat if running, then from Netbeans menu select Run->Run Project. Netbean will start Tomcat and deploy your web app onto the Tomcat server.
I fixed it. All I had to do was restart my computer. I feel so dumb.
clean your project if clean project failed to delete some file then,
Just check there must be a java process running at background.
If you are using windows 10 then follow these steps
open command prompt and type below commands
tasklist | findstr java (hit enter now you can see a task list with pid number )
taskkill /F /PID "PID_OF_JAVA_PROCESS" (where PID_OF_JAVA_PROCESS--> task pid hit enter)
now run the project again
I faced this problem and found a solution. It is very simple. All you need to do is stop the Tomcat services or restart your computer and run your program.

Getting java.awt.HeadlessException after run gui tests on Jenkins

After running gui tests on Jenkins I am getting java.awt.HeadlessException on build Jenkins:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
I am using xvfb in pipeline Jenkins (script), eclipse & maven.
How coud I solve this issue via Jenkins file (script) or maven pom or in another way?
Why am I getting this exception?
Somewhere in your pipeline you probably need to have export DISPLAY=:0.0 or something similar.

How to Build a definition and publish test results for a Java project with maven, Junit and selenium on Visual Studios Team Services VSTS

I have an automation script that uses maven POM.xml to import all the dependencies needed from selenium and junit. The main test uses selenium to open a browser, verify some information, close the browser and the test ends.
When run as Junit it works fine: run as Junit test
When run as Maven Test it works fine as well: run as maven test
In both scenarios, the program opens the browser and navigates through the website as it should do for an automated test.
Now I need to integrate it to VSTS so I can visualize the overall pass/fail test on the VSTS dashboard but I'm not familiarized with this tool too much yet.
So far this is what I have managed to do:
Deploy an agent on my WindowsPC (I want to execute and deploy the project on an Azure VM or another azure instance later on) NOTE: this is the same pc I'm successfully running the program using eclipse as shown in the screenshoots above. https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts
Create a build definition on VSTS but when I queue the definition the build fails: build definition and the build fail.
I don't know why it can't find mt config.txt file since it is located on the same hosted agent in that same directory. I'll appreciate if someone is capable of guiding me through this process so I can run the program from the VSTS and visualize the overall tests that fail and pass on the VSTS dashboard.
UPDATE: I moved the config.txt file to the public directory and the build was successful(I still need to fix this issue because I do not want my work in a public folder).
Now the problem I have is that even though the build is successful and it looks like it is running my "3 tests", When I look at my pc, nothing is happening. it should open chrome and take a screenshot, then open Firefox and take another screenshot and finally open internet explorer and take another screenshot and save each test on different folders but it is only generating folders for chrome and internet explorer (but still those folders does not have the screenshot I'm asking, maybe because the browser is not being open on the computer.)
Here is the log: https://drive.google.com/open?id=1S_MhAUmzj8i9phPQiqS06s0_1cCRrbF0
test output report generated on my computer
test output on vsts
Look at the error message. The error message tells you precisely what the problem is: java.io.FileNotFoundException: Y:\Automation Team\CopaQA\Architecture\local\config.txt (The system cannot find the path specified)
You need to not rely on hard-coded paths.
You say you registered a build agent against your VSTS account... but did you change the agent queue for your build? If the agent queue is "Hosted", you're using Microsoft's hosted agent.
I don't know why it can't find mt config.txt file since it is located on the same hosted agent in that same directory.
It turns out that Java.IO. can't read files located on a shared network drive, I solved this by using the UNC path to that file (//"computername"/"directory"/"file.txt")
Now the problem I have is that even though the build is successful and
it looks like it is running my "3 tests", When I look at my pc,
nothing is happening.
It took me a little reading to realize that to perform UI tests my agent needs to be set up in INTERACTIVE MODE. it can be done following this guide: https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts

How do I run build Release from the command line in Eclipse / Flash Builder

Is there a way to run a Export Release build from the command line in Flash Builder (Eclipse)?
More Context
Flash Builder has debug, run and build release commands or configurations (not sure what they're called). I want to put Flash Builder on the server and invoke the build release configuration from the command line.
You don't need Flash Builder on the server. You can do it with the Flex SDK, Java and Apache ANT installed on the server. If it is a Windows server you can set it up to run like this:
Create an ANT script to update from the repository, then build the Flash app.
Create a .bat file to run the ANT build (literally just a text file 'build.bat' in the folder with the build.xml that just says 'ant' in it).
Set up a scheduled task to run the build.bat at whatever interval you desire, or, if you have SVN on the same server you can set up a post commit hook to run that scheduled task so when a person commits to the repo, the build script will run and the new version can be viewed on the dev server.
I have an ANT script that also will email all devs if the build fails to let everyone know who broke the build, so they can take care of it. If you message me back I would be happy to post a zip for you with my ANT script files you can use an example.
EDIT: I've posted the files to GitHub in case anyone else needs them. https://github.com/royaldigit/ant-flash-build