I have a Mean stack application and i want to add jenkins CI to it. I am not sure as to how to achieve this. I am using bower to install front end packages and npm for other stuff.
Jenkins CI might perform builds which would run tests on mean.
Currntly mean has two types of tests mocha and karma to test the node.js and the angular parts of mean.
You can run them both by running "grunt test"
I've came across these two articles that might help you out
mocha: http://johnhamelink.com/testing-nodejs-with-jenkins.html
karma: http://karma-runner.github.io/0.12/plus/jenkins.html
Good luck with the intergation
Related
I am working on a mobile app. I am using ionic framework with angularjs. So I am programming this app using web technologies. My issues are regarding to the tests. I have unit and end to end (e2e) tests in my application.
Look at my script section in my package.json file:
"scripts": {
"test": "karma start test/karma.conf.js",
"test-single-run": "karma start test/karma.conf.js --single-run"
}
I am able to run my unit tests executing the command in a git console:
npm run test
And my e2e tests executing two commands in two git consoles:
ionic serve (to run my app)
protractor test/protractor-conf.js (to run my e2e tests)
I have two issues here:
I am not able to add a script command to my package.json in order to simplify the protractor command. In the same way of my karma commands for unit testing.
I have tried this:
"e2e" : "protractor test/protractor-conf.js"
In order to run "npm run e2e", But I received this error:
The second issue: I would like to create a build (or pipeline) for all my tests. I mean, to have a command like "rake" in ruby. Where I can run my units and e2e tests through it. This could be very useful in order to save time in the development process and to avoid the fact of forgetting to run my e2e tests.
Ok, so now that you know what the issue is it's pretty easy to get this working. What I did was add a postinstall script that runs webdriver-manager update so that I don't ever forget to do it. Now that you have protractor as a local dependency you should be able to do something like this:
"scripts": {
"postinstall": "webdriver-manager update",
"e2e" : "protractor test/protractor-conf.js"
},
Now each time you run npm install the postinstall script will update webdriver for you and you don't have to remember to run it manually.
As for your second question, look at using Gulp or Grunt to do what you are asking. They are both similar to rake. You can setup a task to run your tests each time it detects file changes.
I want to run tests with Appium written in JavaScript but I can't find any info on how to write/execute them. I have followed the tutorials that I have found and I am pretty sure that I have everything in place to get going.
I have installed:
npm install appium -g
npm install wd in my local directory
Android SDK
my device's driver and I can see it listed when I run adb devices.
When I run appium-doctor everything is with green ticks, executing appium & starts the appium server (I think?) and everything looks fine. What do I need to do from here on?
What files I need to create?
Any info is appreciated!
It looks like you have everything setup that will allow you to run mocha android-simple.js from the Appium node examples. You may need to npm install various modules required by the test's helpers before it will run.
If that works then the examples and the javascript bindings docs are a good starting point.
How can I get ember-cli tests running on Sauce Labs? Testem has an example configuration, but I don't know how to translate that into the ember-cli compiled tests since the testem.json gets packed into the build when tests run.
I tried doing an ember build --env=test and then putting "test_page": "dist/tests/index.html" in my testem.js and just running testem ci --port=8080 as it is in the example, but that gives me 0 tests run.
I believe I have this mostly solved (some issues remain with individual browsers). For posterity you can view my solution here*:
The things that seem to be necessary:
Use NVM to manage node on OSX, things only started to work when I stopped having to sudo random junk.
Don't use localhost, I used localtest here for the hostname, but you can use anything - sauce and localhost don't get along very well.
The command is ember test --port=8080 --host=localtest
I put my sauce stuff in a different testem config file so I can still run ember test on my dev machine.
Hopefully having a starting place saves someone else from doing all of the wrong things I did originally.
*You probably don't need all of that, as we're currently using ember-cli api stubs to mock our API during development so we need to run a separate instance of ember serve.
Maybe someone met any npm module/tutorial/guide/article about "how to test nodejs application using mocha, gruntjs?" Would be glad to any suggestions.
I'd recommend the following (it worked for me):
Install Grunt and get your first sample grunt task running based on the Grunt documentation
Use this grunt task to get server-side Grunt running Mocha tests for you, and this one for client-side tests. From the command line, you can just run $ grunt to watch the results pop up.
At this point, you can check out Mocha interfaces for samples of how your tests can look. Note that there's also should.js, if you're big on rSpec-style tests. Once you've settled on an interface, more Googling/StackOverflowing is the best way to proceed (e.g. Google "Mocha should.js examples").
I have been using jasmine-headless-webkit to run my jasmine specs on my Rails 3.2 app, but I recently switched over to phantomjs/poltergeist to run my request specs, so I am needing to upgrade my jasmine tests to also run on phantom. I'd like to get away from using xvfb on my CI server.
Does anyone have any good way to run jasmine tests using phantom in the console? I'm finding surprisingly little info about it on the web.
The simplest solution which i found is setup guard-jasmine (Guard::Jasmine outside of Guard) and then add guard-jasmine -u http://localhost:3001/ to your build script. Works pretty well on my jenkins. Also you need to install phantomJS on the server. In my case i needed also node.js