Using phantomjs, how to run all scripts within a directory?
Ex: I have 3 tests in c:\tests folder.
\firsttest.js
\secondtest.js
\thirdtest.js
I have tried below, but didn't work
phantomjs tests/
phantomjs tests/*
Can someone let me know how to achieve this?
Thanks,
PhantomJS itself is not a test framework , neither a testing library : it provides scripted headless testing of web applications.
There are no options in phantomjs that allow you to run a set of scripts ; but there are some popular projects which are built on top of PhantomJS to provide convenient high-level functionality for testing purposes. For example, CasperJS.
As said here,
It will recursively scan any passed directory to search for *.js or
*.coffee files and add them to the stack.
A gist is also available here.
Related
I want to run 5 tests from a suite of 200 tests via commandline. The framework uses Selenium with nunit and is built on c#.
After looking for solution online, /run was what I thought could fix my problem but it says invalid argument. Can someone please guide me with what is the parameter to run only few tests from suite via command line for nunit selenium?
You are using obsolete documentation or online answers relating to an older version of NUnit. For NUnit 3, you want the /test option.
BTW, the docs link posted by #vitalis is to legacy docs, as it says on the top of that page. Current docs for the nunit3-console command-line are at https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html
(You're dealing with a program that has been around in various versions for more than 20 years, so it's extra important to make sure you are looking at current information.)
I am using the Karate framework to do the API testing. As part of CI efforts, we send an email at the end of test execution listing the summary of test results. There is a need to include the screeshot of the test execution counts from 'overview-feature.html' file.
I did so through the TestRunner.java file - launched Chrome using Chrome.start() and then using it to take screenshot. It all works well locally on Windows.
However when executing on CI server which is a Unix box, the chrome executable is not present in the default location (usr/bin/google-chrome) and hence the connection for the localhost fails.
Is there a way we can change the default location of the chrome executable?
PS: Apologies if this was too trivial to be asked.
Yes Chrome on CI is hard to get right, refer: https://stackoverflow.com/a/62325328/143475 - note that CI boxes typically are "headless" a browser may not be even installed.
I think the best thing for you is to ZIP the HTML and send it. But I really think you need to work with some CI experts, because the report generation and e-mailing business is normally done by things like Jenkins. What you are doing is certainly not normal or best-practice.
If you really want, there is a Karate Docker container that can give you a proper Chrome instance (see docs) but that is overkill for what you need.
EDIT: The Chrome Java API allows for customization of the executable path and this is in the docs: https://github.com/intuit/karate/tree/master/karate-core#chrome-java-api
It should be something like this:
Chrome.start("/opt/blah/chrome");
I really don't know how to ask question to Google about this, so I excuse me that it is naive.
Our team is developing SPA application in ReactJS. We also do back-end programming for NodeJS. Our project recently got more e2e tests. They are written using webdriver.io packages. Everything works as expected but circa 30 tests run about 50 minutes. It is too long to pause developer work and force him to run tests.
We came with the idea that now when we have so many tests, we need to run them on separate computer (other than a developer's laptop, further I call it e2e-laptop).
So I programmed a bash script and installed Ubuntu on a e2e-laptop. My idea is, that developer who wants to run e2e test logs in on e2e-laptop with ssh, runs specified script with arguments (eg: --rev= specific git revision the tests should run on, --email= where to send Allure report) and logs out. After tests are done he gets Allure report in his mailbox.
This all sounds to me OK, but not very well. It works - it is like a dirty MVP. But what I really would like to give my team is the web browser based UI that gives the features my script has. I can imagine this software is hosted on e2e-laptop, every developer can open its webpage address in his local browser. Then after authorization, there are options: run all specs, run chosen specs, send report and more. It would be the best if that software could also allow simultaneous running of tests commissioned by multiple developers.
What software I need?
You need a continuous integration tool. https://stackify.com/top-continuous-integration-tools/
I recommend Jenkins.
I would first try to run your selenium tests headless in a docker container on your laptop. Once you are able to do that, use that same configuration in your docker container running in Bitbucket pipelines. It could actually be the same container and the same scripts. Then, developers can just make a branch and work with the tests on that branch. If only a certain subset of tests need to run, then the developer can make the necessary changes on his or her local branch to run those tests and push it up to Bitbucket. This should help with the configuration https://github.com/SeleniumHQ/docker-selenium.
I would like to run many instances of phantomjs at once. The reason I would like to use phantomjs rather than selenium with firefox/chrome/ie is the cookie separation and the ease of using proxies if every needed (some of our systems will need to be accessed from different IP's). Plus phantomjs seems much slimmer/faster than browsers with "heads".
I would also like to generate the test scripts using selenium IDE (I've experimented with Resurrectio+casperjs its good but selenium seems better) then run them as PHP using php-webdriver.
I've been trying to understand how all these pieces fit together so is would this process work....
Generate the test scripts in selenium IDE with firefox then export them to python
Convert this Python script to a facebooks php-webdriver version. Looks like I'll have to manually do this?
Run Phantom.js with this php script and point it at the selenium java server to execute the script.
Is this all correct? Can I run multiple instances simultaneously on once machine? Will I need grid? Where does ghostdriver fit in all this!?
My team creates a number of dynamic/data-driven websites. We use a CruiseControl.NET to download the code, create test data, run unit tests, and install each site into IIS for manual testing. However we haven't found a good tool (or tools) that can actually run through some simple tests of the websites, such as checking for broken links or invalid HTML.
Are there any good tools that we can incorporate into our build process to automate basic website testing? E.g. check for broken links, check for HTML/JavaScript/CSS coding errors, and so on? Load testing would be great too.
Looking for something totally generic; we don't need to write/record scripts for playback. Just something to cover the basics.
Thank you!
-James
For link checking you could always look at http://linkchecker.sourceforge.net/ if that isn't suitable they list other alternatives.
It also seems like it is an active project.
JSLint does javascript validation and there are two options for executing it via the commandline so that might be worth a look too http://www.jslint.com/