I have a phantomjs script that navigates to some pages and store some information about them in a file. Now I want to unit test this script. My problem is that usually the frameworks test my code on client side, so I can't use the PhantomJS API.
I tried to use jasmine-node (https://github.com/mhevery/jasmine-node). It works "server-side", but I can't use all the PhantomJS API because it obviously run my tests with nodejs instead of phantom. Is there a better option to test PhantomJS apps at server-side?
I found two solutions. I think the most complete way to test phantomJS at "server side" is to use CasperJS.
Another solution I have found looking at the phantomjs source code. They use jasmine for testing and it's possible to apply the same idea to my own tests. The run-tests.js is the starting point for this approach.
Is there a way to run unit test for a WebGL (GLGE) webapp in a headless browser?
I'd like to run the tests on a jenkins server, so the tests must run on a headless (phantom.js) brower.
Anybody already tried that?
Cheers
As of 2020 using puppeteer is probably the easiest way to use a headless browser that supports WebGL.
You can also use Chromium in headless mode directly
I'm attempting to use qUnit to perform some unit testing that requires the screens generated by my web app to run. My idea is to put my application into an iframe embedded in my qUnit test page. However this does not seem to work (in chrome) I don't seem to be able to access the web app's iframe. If I do this in chrome's console I get undefined:
frames['myApp'].document
I think this is to do with some kind of cross domain scripting security but, both my web app and my test page are being served from localhost so I don't see why this is occurring, also I have started Chrome with the --disable-web-security parameter but this has not fixed.
Is there a better way to do unit testing that requires output from my application?
You can try publish these tests on localhost by any simple http server, for example if you have a node you can use https://github.com/nodeapps/http-server.
I have a similar situation tests are running in iframe and this work without problems.
I am creating an automated testing framework in Perl for regression tests. I would like to post my results from the test machines. I have used django before where the server ran standalone with no installation needed. Which MVC framework in Perl has its own standalone server? Basically, which of the Perl MVC frameworks is closest to django's server capability and DRY (Don't Repeat Yourself) principles?
P.S. I will not rewrite my framework in python
P.S.S I will not use Perl framework and django as MVC
(no python on servers :( )
Catalyst comes with a built-in test server - check Catalyst::Manual::Tutorial for more details. This looks like a good place to start.
Every popular Perl web framework comes with it's own server: Catalyst, CGI::Application, Jifty. Most popular and DRY-following is Catalyst (don't know about DRY in Jifty).
Also there test result aggregators like Smolder.
Catalyst comes with it's own server script/myapp_server.pl. You can also deploy with our without a reverse proxy using the built in server, but in this case it's advisable to use Catalyst::Engine::HTTP::Prefork: CATALYST_ENGINE='HTTP::Prefork' script/myapp_server.pl
I believe Jifty also has a built in dev server, as does Squatting, but I haven't used either of them.
Maybe Catalyst.
I don't know if it has a stand alone server, but it's Perl with MVC,
One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Again the basic requirements are: Given a url, the server needs to produce an image file of the rendered web page at that url. Thanks in advance!
You might also want to take a look at webkit, it's known for being easier to embed (used by Adobe for AIR, by Google for Chrome, by Apple for the iPhone...) then other rendering engines. This might take a little more work to setup, but it would be a lot more stable than some hack that launched a webbrowser and took a screenshot.
IF your server is a Mac, then I recommend webkit2png, which is a short python program that leverages WebKit's Objective-C API to render an URL. Personally, I use it in combination with WWW::Mechanize to walk my development site and make screenshots of every page -- useful for testing functionality, showing clients and keeping screenshots up-to-date. The resulting screenshot is perfect, but sometimes very tall for long, scrolling pages.
IF your server has a non-bare-bones Linux distro with KDE installed, then you might try khtml2png. I have not tried that myself, but saw it mentioned on the webkit2png page.
PhantomJS is a headless (commandline) WebKit-based browser which can be easily scripted to save a screenshot of webpage.
You actually need to have the server launch the web browser in question and take a screenshot of the application with the appropriate libraries. Apache will not render the page for you so you have to have software that will.
Yes, that is what is needed. I do this in asp.net, and I actually create a WebBrowser object that is avaialable in the .Net framework class libraries to generate the screenshot.
I use the http://webthumb.bluga.net service for thumbnail generation. Robust, powerful, easy to use, and very reasonable rates. I have a high traffic production website using this service and it works very well. Given the difficulty of creating a robust web screenshot service, it's nice to have someone else do the hard work.
A non-free solution for Java is WebRenderer. Interesting feature: it can emulate Safari, IE or Firefox browsers when rendering. They have a desktop version and a headless server version. Also they have example code showing how to render a screenshot image of a webpage.
virtual framebuffer X server
I would rather recommend XVFB (virtual framebuffer X server) is the best solution for taking screenshots of a headless server. Virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices.
I am using that on my server for testing URLs and taking its screenshot. We are using Ubuntu & XVFB + FIREFOX. It is working fine. Modify according to your needs.Take a look on these articles. It might be use full for you.
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://linux.about.com/cs/linux101/g/xvfb.htm
http://www.xfree86.org/4.0.1/Xvfb.1.html