Multiple terminal window in Jenkins? - angularjs

Recenlty I have started with some Jenkins tutorials to learn about this tool.
As an excersise I would like to start my Angular project and run some protractor e2e tests on it.
Normally I would open terminal window, type : npm install, npm start and run protractor tests. I have one issue though to execute this on Jenkins.
Command 'npm start' will run my angular application on localhost:4200. That require some time and after that this terminal window is "frozen" there is information that my application is running on localhost but if I want to run tests I need to open another terminal window and type command there.
I don't know how to do this in Jenkins because when I run my project and observe logs, I can see that my project is running and everything is OK, but I cannot type any command to run test because this terminal window is busy with info:
webpack: compiled successfully.
Can I somehow open another terminal window during Jenkins build and run command there?

Use & at the end of the command that will run it in background and didn't freeze the terminal.
But As per me I don't think if you are running cmd through Jenkins will froze the terminal.
Each build step is a separate process that Jenkins spawns off. They don't share anything, neither current directory, nor environment variables set/changed within the build step in-spite you hard coded the location. Each new build step starts by spawning a new process off the parent process (the one running Jenkins)
Please share some screenshot if & didn't work for you.

Related

Tosca and Jenkins

Does anybody work with Tosca and Jenkins?
I have problems to run my batch script from Jenkins. It does not open browser, but job is finished successfully. Batch script runs normally when I try to run in on Windows, without Jenkins.
Anybody has an experience using these two tools together?
In order to use Tosca CI with Jenkins you need to:
Configure your Jenkins build project
Add an additional build step (Execute Windows batch command)
Call ToscaCIClient.exe/ToscaCIClient.jar with parameters
e.g. "PathToTosca\ToscaCI\Client\ToscaCIClient.exe" -t junit -r PathToResults\result.xml
Further information can be found here: https://support.tricentis.com/community/article.do?number=KB0012411
The issue your facing is because your running Jenkins as windows service, in this case headless execution happens technically your script is executed for other user account.
Solution
Instead of installing Jenkins host it on Apache Tomcat server
Download Jenkins war file
Copy it inside webapps folder of Tomcat
Run startup.bat
Refer-
https://www.tutorialspoint.com/jenkins/jenkins_tomcat_setup.htm
I had faced the same issue.
I am guessing your slave machine running the test has jenkins services installed as services.
Uninstall the service. (.jenkins/jenkins-slave.exe uninstall)
Use the .jnlp or slave.jar to connect the machine as a slave.
Your test should run fine after that.
If it does just create a batch file to connect the machine as slave whenever it is logged in.
I tried that. But in any case, Jenkins does not open the browser, so Tests from Execution List and I do not know why.
We use Tosca 10.

Error in Selenium tests triggered from batch script in TFS Build step

Step 1. I have written selenium tests and bundled it into executable jar.
Step 2. When I execute this jar tests runs normally. Invokes New browser and execute all steps.
Step 3. I created bat file to execute this jar. In this case also test execution happens normally.
Step 4. TFS Build integration. (TFS 2015)
- I created new build definition in TFS
- Added build step "Batch Script"
- Entered path of bat file created in step 3 in build step
- When I Queue this build. bat file gets called and test execution starts. But It does not open new browser..console says Started IE driver...it starts driver internal to build agent. and execution fails on setting value in textbox.
Click to see TFS Build Cosole
I can't use Visual studio tests. Requirement is to selenium tests should be triggered from jar created on Step 1.
Make sure the build agent is running in interactive mode.
First you could try to RDP to the remote build server(the build agent located) and manually run the batch file to see if it works.
If it's also not work then the issue may related the IE browser on the server.
If it works then maybe the TFS build service account don't have enough permission to run the IE driver. Please make sure the build service account has local Admin permission on the build server.

Jenkins/Windows - Launch TestNG suite from .bat

Stackoverflow helped me a lot to reach that point but now I'm completely stuck, here is my problem :
I'm currently developing several tests to check a website. I code with Java in Eclipse, using testNG plugin with ReportNG for report, all of this using Windows 7 pro.
My tests work, and my report is well generated, so now I have to put it on Jenkins for my company so they will run my tests every X hours.
In order to launch my tests, I have made a file, named Run.bat, which runs the Java code, I tested it and it works, here is the code :
Run.bat
set classpath=blex_test_v1\bin;blex_test_v1\lib\*
java org.testng.TestNG blex_test_v1\blex_test_v1.xml
I now try to launch the tests on Jenkins, creating a new job and configuring it with the build section :
Run.bat
And this is my problem, I've tried everything (relative path, only the name of the file etc...) I always get this error :
java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/jobs/blex_functional_test/workspace"): error=2, No such file or directory
So I checked the Jenkins workspace but my Run.bat is in it :
Workspace
I have read that Jenkins is in Linux so it might cause problem with bat files, so I tried to create a script but I didn't succeed either ..
So my question is : How can I run my test on Jenkins using my file Run.bat ? What am I doing wrong here ?
Thanks a lot !
Finally I can add an answer :
Jenkins is installed on a Unix machine so you can't run a bat file, it has to be a bash script.
To create a bash script, refer here.
Then you have to make sure that the plugin Xvfb is installed (and works) on the computer where Jenkins is installed.
I use testNG with reportNg and it doesn't work with the last firefox version so you I use firefox v34.0.5 and this version must be installed also on the Jenkins computer.
If you want to open the report after the execution, install another plugin and configure it (report HTML or something like that)
God it took me about a week but it's good to see it working !

X11: Start desktop manager inside daemon

What I'm trying to do:
Make screenshots of desktop and running program (Firefox Webdriver with Selenium, if it's important) in daemon (celeryd) in auto mode.
And I need desktop manager to be running, this is mandatory requirement. Currently I'm trying to use Fluxbox but I can switch to any other manager.
Current progress:
I can start X-server (Xvfb) in daemon and start Selenium Webdriver. Fluxbox start succeeds when I try to make it from terminal, but fails in daemon with following errors in log:
Can't create directory
Failed to load database:
Failed to load database:/init
Retrying with: /etc/X11/fluxbox/init
I tried to specify init-file directly, but Can't create directory error still exists and Fluxbox fails to start.
This might be daemon-mode restriction.
Question:
Is it possible to run any desktop manager inside daemon?
If yes, then how can I do this?

Terminate whole build process tree on Cancel

Example, with these GAE build settings:
{
"cmd": ["c:/python27/python", "C:/Program Files/Google/google_appengine/dev_appserver.py", "./"],
"working_dir": "$file_path",
"selector": "source.python",
"name": "Google App Engine: App Server"
},
When I launch this build system, here are processes connected to ST:
When I terminate build (Tools > Cancel Build), ST terminates just top process, leaving ghost child process running:
I need to terminate those processes by hand, or they'll still run in background, and if left unnoticed any other launch of GAE build will result in error at some point.
I run build schemes with shell ("shell": true), but also without shell result is same - child processes are left running in background. So, does anyone knows how to configure ST build system that will clean it's state on Cancel?
I ran into this as well, so I decided that instead of using a build system, I would just open up a command prompt and let the GAE dev server run on it's own, outside of ST2. st2-gae-python.
The plugin is a work in progress, I just got it to where I could run the GAE dev server quickly, but it works for what it was intended for so far.
Right-click on your app's main folder.
Select `GAE.py - Create dev settings.` to generate `.gaedevserver-settings` file.
Edit `.gaedevserver-settings` file to your needs.
Right-click on your app's main folder.
Select `GAE.py - Start dev server.`
The GAE.py - Start dev server. selection opens a command prompt that runs up dev_appserver.py

Resources