Basically, whenever you want to run some scenario, selenium will open a browser and execute the script.This is a good option if you need cross-platform support since the next solution will only work on Linux.
![]() Basically, instead of outputting GUI on a physical screen, this program will create a virtual framebuffer and display UI there. In this article, I am going to introduce a nice alternative you can use on Linux which allows you to run real browsers - Firefox and Chrome, headless - using Xvfb. It has particularly been widely adopted for running JavaScript test suites. Although it is built on top on WebKit - the same rendering engine both Safari and Chrome use, it still behaves in subtly different ways from those browsers, which can cause false positives (tests failing when there is not a real defect) and in some cases performance degradation of your test suite. Since PhantomJS isnt a real browser in the sense that no end-user actually use it, fixing these issues specifically for PhantomJS becomes an upkeep cost of the test suite, rather than something that directly improves the product. Getting developers to write tests consistently is hard enough, but if maintaining the tests becomes annoying - which false positives definitely are - it can become demoralizing. However, in many cases the continuous integration servers we use are Linux servers, and do not have displays. It provides a fake display buffer for graphical programs to write to, thus allowing any program to run headlessly. You may see a cryptic warning in the terminal, but otherwise its not very exciting because you dont actually see anything. It allows you to run your tests without having an unwanted window and its easy to setup and use. However, even if you dont use Linux for development, you may still use Linux for continuous integration, in which case, maybe you are currently using PhantomJS to run tests. But if PhantomJS is starting to create unwanted overhead for you, consider switching to this setup. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |