How to able CI to continue working after it finishes e2e test - jenkins

I have this test running on CI but after it finishes it stall the whole process. How can I able to stop or allow to process to continue with Deploy?
[1] Audit Log Viewer - Grid
[1] ✓ should not show extra columns when moving from "asset/alert/cases" to other application
[1]
[1] Executed 1 of 20 specs INCOMPLETE (19 SKIPPED) in 20 secs.
[1] [12:14:11] I/launcher - 0 instance(s) of WebDriver still running
[1] [12:14:11] I/launcher - chrome #01 passed
[1] ng e2e -s false -pc proxy.conf.json exited with code 0
Stack:
1. Angular 5.x
2. Typescript
3. Angular-Cli

Answer: I was using concurrently /dist/app.js && npm run e2e
I separated the calls and killing the /dist/app.js process after the tests are finished running.
That way it allows me to invoke npm run e2e without stalling the process.

Related

Start Appium on jenkins and wait for it to fully complete startup

I m setting up jenkins to run appium scripts. The issue I am seeing is if I run main.js to start appium the jenkins will not execute next commands and if I put appium in background next statements are executed immediately. Is there any way to start appium in background and wait for it to complete? and also once test execution complete how will I stop appium if appium process is in background?
Thanks in Advance
Shrikanth
You can create one folder called build and put your application in same folder and create a batch file using following commands :
cd /d C"":\Program Files (x86)\Appium\node_modules""
node appium --address 127.0.0.1 --port 4723 --app C:\Build\Application.apk --pre-launch --platform-name Android --platform-version 23 --automation-name Appium --device-name "DEVICEID" --log-no-color
Trigger this batch file from Jenkins and give wait of 20000 millisecond before running your test script.

fitnesse hangs in fitnesse.testrunner.MultipleTestsRunner.waitForTestSystemToSendResults

In approximately 1 of 10 of our fitnesse test runs running headless (from cmd line, not in browser) the run hangs in fitnesse.testrunner.MultipleTestsRunner.waitForTestSystemToSendResults
We ensured with using listeners and console output that all tests that were announced to run are completed. We used the following methods to ensure that:
fitnesse.testrunner.TestsRunnerListener.announceNumberTestsToRun(int) and fitnesse.testsystems.TestSystemListener.testComplete(PageType, TestSummary)
So our tests always hang after the last test of the suite was executed. The wait is done until a volatile member int testsInProgressCount is decreased to 0 but this does not seem to happen.
Does anybody have similar issues with fitnesse or any idea what is the reason or a good idea how to troubleshoot the issue?
Some more information:
Fitnesse version: 20150814
Platform: Linux centos 6.5 (kernel is 2.6.32-431.el6.x86_64)
Cmdline (simplified): java -cp <CLASSPATH> -r fitnesse -c <TestSuiteName>?suite&format=xml&includehtmlFalse -b OutFile -p <PORT> fitnesseMain.FitNesseMain
using 1.8

Android Test stopping in instantiating tests

When i run my ui test, it just stopping in instantiating tests...
Uploading file:
local path: /Users/eclo/AndroidStudioProjects/Minicooper4android/Minicooper4android/app/build/outputs/apk/NAMmogujie714-uiTest-debug-androidTest-unaligned.apk
remote path: /data/local/tmp/com.mogujie.test
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.mogujie.test
Running tests
What's wrong?

Jenkins does not stop cucumber tests when aborting (pressing the stop[x] button)

I have calabash running iOS tests on Jenkins. When the job encounters fails I sometimes manually abort the tests by pressing the stop[x] button within the job. The problem is the next test in the feature file begins running even though I aborted. This behavior is not observed when launching the tests through the terminal. When exiting the cucumber test in the terminal the sim returns to home and no other test are launched.
I found a hook that might be useful
After do |s|
# Tell Cucumber to quit after this scenario is done - if it failed.
Cucumber.wants_to_quit = true if s.failed?
end
However, there are times when I don't want it to stop just because one scenario failed. I feel like Jenkins needs to kill all processes and its not.
If someone knows how to kill calabash and its instances manually via terminal after Jenkins has been instructed to abort, I would be interested in that too.
I tried:
ps aux | grep -i instruments | awk {'print $2'} | xargs kill -9
Unfortunately that did not work. Possibly two reasons
greping instruments shows two or more process
20272 ?? S 0:00.00 sh -c xcrun instruments -w "iPhone 5 (8.1 Simulator)...
20273 ?? S 0:00.45 /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -w iPhone 5]...
Should I switch awk to print column 1?
or reason two
I'm not greping the correct process?
Here is some of my version info:
calabash-ios version: 0.11.4
Calabash::Cucumber::MIN_SERVER_VERSION: 0.11.4
Xcode 6.1
You have to let Jenkins to find all forked processes. Depending on the Job type you have to pass different environment entries into the forked process. This question is about the other way (so how to make Jenkins NOT to stop processes), but the names of the possible environment entries are there. Just pass these environment entries below to each forked process and then the process tree killer will find them:
BUILD_ID
HUDSON_SERVER_COOKIE
JENKINS_COOKIE
JENKINS_SERVER_COOKIE
HUDSON_COOKIE

Unable to get JSCover and PhantomJS to run Jasmine test on Cloudbees

I am currently trying to run JSCover in web server mode to determine the coverage of my Jasmine tests that are executed in the PhantomJS headless browser. I am also using grunt+nodejs to kick off the tests.
The code I use in my gruntfile to start the JSCover server and execute phantomJS is:
// Start JSCover Server
var childProcess = require('child_process'),
var JSCOVER_PORT = "43287";
var JAVA_HOME = process.env.JAVA_HOME;
var jsCoverChildArgs = [
"-jar", "src/js/test/tools/JSCover-all.jar",
"-ws",
"--branch",
"--port="+JSCOVER_PORT,
"--document-root=./",
"--report-dir=target/",
"--no-instrument=src/js/lib/",
"--no-instrument=src/js/test/",
"--no-instrument=src/js/test/lib/"
];
var jsCoverProc = childProcess.spawn(JAVA_HOME + "/bin/java", jsCoverChildArgs);
// Start PhantomJS
var phantomjs = require('phantomjs'),
var binPath = phantomjs.path,
var childArgs = [
'src/js/test/lib/phantomjs_jasminexml_runner.js',
'http://localhost:'+JSCOVER_PORT+'/src/js/test/SpecRunner.html',
'target/surefire-reports'
];
runner = childProcess.execFile(binPath, childArgs);
runner.on('exit', function (code) {
// Tests have finished, so clean up the process
var success = (code === 0) ? true : false;
jsCoverProc.kill(); // kill the JSCover server now that we are done with it
done(success);
});
However, when I run the web server on a Jenkins node in cloudbees and then run phantomjs against it, I get one of the following errors:
Some tests start to run, but then the process fails:
A spec : should be able to have a mock lo-dash ...
Warning: Task "test" failed. Use --force to continue.
Aborted due to warnings.
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE
PhantomJS is unable to access the JSCover server:
Running "test" task
phantomjs> Could not load 'http://127.0.0.1:43287/src/js/test/SpecRunner.html'.
Warning: Task "test" failed. Use --force to continue.
For the second error, I have tried to use different ports and hostnames that I set (e.g. 127.0.0.1 or localhost for hostnames, and 4327, 43287, etc. for ports). The ports are not being dynamically set at build time - I have them hardcoded in my grunt script.
Any thoughts on why the errors above might be occurring or why I am having issues running and accessing the JSCover server on a Cloudbees Jenkins node (but never on my local machine)?
So when you execute JSCover with any process, it takes time to be up. If we expect it to be up earlier that it is, the errors are bound to come.
Quoting from the great article: http://blog.johnryding.com/post/46757192364/javascript-code-coverage-with-phantomjs-jasmine-and
Now that I had a code coverage tool that met all of my requirements,
the last part was to get this code to run as part of our Jenkins build
(which utilizes a grunt script). This was easy to get running, but I
encountered two errors that consistently broke my builds:
Sometimes phantomJS would fail to connect to the JSCover server
Sometimes phantomJS would connect to the server, but then give up executing my tests at a random point during the run.
These were really weird issues that only occurred on my team’s Jenkins nodes and were hard to diagnose - even though they turned out to be simple fixes.
For issue 1, that error was the result of my grunt script not waiting for JSCover to start before I executed phantomJS.
For the second issue, it turns out that my team was using a special jasmine test runner to help with producing XML files after tests completed. The problem with this file was that it had a function that waited for Jasmine to complete its execution, but utilized an extremely short timeout before it gave up running the tests. This was a problem with Jenkins + JSCover because it took a longer time for the tests to load and run now that they had to be loaded from a web server instead of straight from the file system. Fortunately, this fix was as easy as increasing the timeout.
I would say that you need to wait for a while after spawning JSCover - in the past I have done things with webdriver when I have spawned, and then waited for it to be available (ideally you can look for a response and sleep, repeat, until the spawned process is ready).
Ie look for a valid http reponse from 127.0.0.1:43287 before continuing (whatever "valid" means that the server is up).

Resources