JSTestDriver concurrent tests - javascript

I've been evaluating JSTestDriver, and it seems to be working well. I want to use it in a continuous integration environment, and I want to know if multiple projects can be testing against the same JSTestDriver server at the same time.
So my configuration is I have 1 JSTestDriver server with 3 different browsers captured. Can multiple projects run their test suites against that same server? Or is a JSTestDriver server only designed to run one test suite at a time?

I am using JSTestDriver in a continious integration environment, too. Unfortunately, I noted that JSTestDriver gets instable when running for a long time, which means that we need to restart the JSTestDriver server process and reconnect all browser slaved. I found this behavior also described in this post.
Therefore, we are restarting the JSTestDriver before each build to make sure it is working. That means that you can not use one JSTestDriver for all builds because it would might be restarted by one build while the other build wants to run tests on it. Therefore, every build plan in your Continious Integration should have an own instance of JSTestDriver to use, and developers should use their own instances running on their local machine.

The conf file specifies all the files needed to do a test run. The better question might be if your able to run multiple conf files at the same time. Personally I would just include all the files needed to be tested in one conf file. But if that's not an option here are some links.
Check this link out: (Grunt-JsTestDriver)
https://npmjs.org/package/grunt-jstestdriver
https://github.com/rickyclegg/this/blob/master/node_modules/grunt-jstestdriver/README.md

Related

How do I open a terminal tab with an NPM script?

I would like to automate the testing sequence of my Cordova app.
I know I can run nom scripts in sequence by specifying a script name, and then specifying a series of scripts separated by semicolons. This is working perfectly for other parts of my dev environment.
For the UI tests, I'm using Webdriver and Appium. This is the series of scripts I would like to automate, but I can't seem to find out what the commands are to get the specific sequence running (specifically regarding the Appium server):
1) Run jest unit tests (this is not a problem)
2) If jest tests do not fail, start the Appium server in a new terminal tab
3) Either wait for a successful signal (not sure what this would be) that the Appium server has started or set a reasonable timeout
4) Run the UI tests with WebDriver/Mocha (this is also not a problem running by itself).
5) Kill the Appium server
Part 3 is my hurdle, specifically how to get the Appium started in a separate terminal tab. Chaining these together would be great.
The goal here is to automate the entire testing series in something like npm run allTheTests so I can leave and get a sandwich, send a text, read a Medium article (etc.) while the tests complete.
Many thanks =)

How do I use wdio.conf.js?

I'm trying to use webdriverio with the jasmine test framework. I can run my test by typing jasmine at the command line. However, when I do wdio wdio.conf.js it opens a bunch of extra browsers which don't do anything. I'm just wondering what the point of the wdio.conf.js file is when I can just run jasmine at the commandline. Ultimately it's the same thing, right? However, I can't get the wdio.conf.js file to work in the same manner so it's useless to me. Perhaps I'm not managing the browser clients correctly but I don't see any guidelines on how this is commonly done. I read the documentation but it's pretty vague beyond auto-generating the wdio.conf file so that 'everything just works'. Am I supposed to use grunt or gulp to run my tests or are those tools separate from the wdio.conf idea?
I'm Just trying to get my head around all these different tools. All I need to do is make multiple automated tests to test a website. Thanks for your help.
This may help, https://github.com/webdriverio/webdriverio/blob/master/examples/standalone/webdriverio.with.jasmine.spec.js
I asked a similar question, which was answered by the main contributor here, Running WebdriverIO 'spec' tests as node file

packaging protractor test script and the dependencies into one file

Now I make my protractor to work. Then I have another question: How to package the spec files and all the dependencies into one file, such as rpm or other format, so I can easily install it on another machine to run it? I searched the Internet and found some tools to package the javascript and CSS and images used in web page. But in my case, I only need to package the javascript I write to do the testing to one file.
I appreciate any suggestions.
The short answer is that's not possible.
When you run protractor on a fresh machine you need to have
an instance of selenium-webdriver server running (with all the browsers you want to test)
nodejs
But, assuming that the new computer you run protractor in has nodejs and selenium-webdriver is set up (i.e. either the local computer has it running, or you're testing over network like using saucelabs), then I guess you can zip up the file to send as one file.

What is the correct way to test javascript with unit AND integrations tests, using Visual Studio and Team City?

I have got javascript tests running in visual studio using Resharper and Jasmine. It all works fine. Now however I want to run an integration test. After looking into this I just can't work out whether I should be using Karma or PhantomJs or both? And whether they link to resharper?
I then have to run all my tests on the continuous integration server using Team City. Doesn't seem like there is a clear logical way to architect front end testing from dev right through to the CI server.
For example do I really need to use Karma locally and on the CI server? I don't want to because it is not baked into visual studio and I will have to keep opening the command line and running my tests manually. This will annoy other developers and they won't bother running them I imagine. Help!
We are using Team City by the way....
Neither of these test runners are connected to Resharper in any form. I don't think there is a one and only "correct" way of running Jasmine tests in TeamCity currently - for all approaches I am aware of there is a bit of assembly required.
Personally I am using a combination of PhantomJS and the Jasmine TeamCity Reporter which works like this:
Get a list of unique test URLs from server - each of these test suites will use the Jasmine TeamCity Reporter to log results
for each test URL dynamically generate a test JS file to be used for phantom and write it to disk
use PhantomJS to run the JS file which now will load the test suite page and its test result will be written to console where they are picked up by TeamCity.

Javascript/PHP continuous integration, testing, deployment

I am building a web application in javascript with a PHP/MySQL backend. The entire UI is Javascript based, except the index.php which only contains a few PHP lines. Out of that, it all works with AJAX calls. Then I have a PHP backend answering the AJAX calls with JSON.
I have a few questions on how to create a "clean" deployment process. My process should contain:
CI Running Javascript & PHP unit tests, backend JSON tests
JS compression
Deployment to a test server
UI/Acceptance testing
Eventual deployment to a prod server
What tools should I use to do that? I see many CI servers, but which one can do Javascript testing and compression and PHP unit testing?
How can I do staging in Javascript and PHP? I don't want my Javascript on the test instance to connect to the prod backend, neither the test backend to connect to the prod database. How should I implement this switch ?
Moreover, would it be better if I split my project in 2 parts - front-end and back-end or is it OK to deploy/test the whole javascript/php thing as one package?
Thank you a lot for you help
You can do CI of heterogeneous projects using Jenkins
Aside of unit tests you can set there coverage, mess detection and even selenium by simple plugins.
You can do simple deployment using any version control software just don't hardcode your javascript urls and dont user absolute urls. Instead base your your config on environmental variables on your staging and production. IDE's like PhpStorm also have deployment systems if you are interested in something more advanced.
CodeShip (www.codeship.com) can do this. It has the ability to run tools like Grunt or Gulp, Bower, NPM and Composer. And it can run phpunit, selenium, qunit etc. and it can deploy.

Categories

Resources