Running multiple selenium tests simultaneously in node js - javascript

How can i locally run multiple selenium tests at the same time using node js?
I have tried combining selenium-webdriver and async but the tests only run as a series.
Am i missing something? Can someone provide an actual example? (dont just reference me to Selenium Grid or some framework)

Related

K6 how run node command in the setup function

Please excuse my limited K6/Javascript knowledge.
I have been given a javascript file that can be used to create a batch of users to be used within my k6 load test.
The script is currently ran from the commmand line using this command:
node helpers/createUsers.js 10
I want to run this script in the 'setup' function in K6.
Can I run node commands directly in K6 as above, or do I have to turn it into an export function and then call it?
To my knowledge, you cannot run nodeJS or any nodeJS modules directly from a k6 test script. If the script helpers/createUsers.js is using any node modules, then you should follow this. and have the script in the setup() function.

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 =)

Is it possible to use JSCover or any other tool to get JavaScript code coverage running Java Selenium WebDriver tests in Browser?

Is there a way to run Selenium WebDriver tests in a browser (or just run a test scenario manually in a browser), and get the code coverage of the web-app written in JavaScript? Are there any other code coverage tools except JSCover that can do such task?
Is there a way to run Selenium WebDriver tests in a browser (or just
run a test scenario manually in a browser), and get the code coverage
of the web-app written in JavaScript?
JSCover can when run in proxy mode (without HTTPS). A more robust approach would be to pre-instrument your JS before running your tests, which can be done by JSCOver and other tools (see answer to second question).
JSCover can also save data between pages using local-storage which can be useful for re-using existing selenium suites.
You'll need to add some code to the end of your tests to save the coverage data. To do that with JSCover, see http://tntim96.github.io/JSCover/manual/manual.xml#fileSystemSave.
Are there any other code coverage tools except JSCover that can do
such task?
There is also Istanbul and BlanketJS which may be able to be used with the pre-instrumentation approach.

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.

How to execute server and client tests in one command/process?

as I'm developing a web application using AngularJS in the front-end and Node.js in the server. For now I'm writing tests for the node server (based on Express) using Mocha (+ Chai + Supertest), and client side tests using Mocha and Testacular as a test runner, since Testacular is the tool of choice with Angular.
Note that the Angular app is "embedded" in the node app, as it's located in the template files.
My testing process : for server tests, I just npm test, i.e. mocha <my-test-folder> <my-test-options> ; for client tests, I launch a Testacular server that watches changes in the desired files. But I don't like this parallel and disconnected process and I'm sure there's a better, unified automated way.
Could help me refine the process ?
In my travels I haven't seen a precident for this, but you should be able to achieve it using grunt. You can make a grunt target that calls both.
I have a github project that should help show how to use testacular on an angular project using grunt which will at least help with the client part; will help get you part of the way there.

Categories

Resources