PhantomJS Has Many Uses, But Functional Testing Isn't One of Them
PhantomJS is fully rendering pages under the hood, so the results can be exported as images. This is very easy to set up, and so is a useful approach for most projects requiring the generation of many browser screenshots.
Generate Data for Performance Analysis
PhantomJS makes it fairly straightforward to automate the generation of data for performance analysis of web applications. Most organizations do far too little of this in any rigorous way, so anything that makes it easier is welcome.
Automate Interaction with a Web Application
In a similar vein, it is not unusual to find yourself in the situation of having to automate the manual operation of a third party web application. The usual situation is that the API is limited or non-existent, while the nature of the business relationship and available resources make it more cost effective to build the tool than arm-wrestle with the third party and have them add the features you need.
But What About Functional Testing?
Seeing the uses noted above, one might then think that it is helpful to apply PhantomJS to the automated functional testing of a web application. By this I primarily mean end to end testing, such as via Selenium: the automation drives an actual browser through use cases and checks the results. Most of what I'm about to say still applies to unit tests, however. It is tempting to reach for PhantomJS for automated testing when you are stuck in the all too common situation of limited access and control over your test deployment platforms, a sad state of affairs that is all too common in larger organizations. If you are working in the Node.js ecosystem then PhantomJS can become just another package dependency, and now your test scripts can run a browser in addition to a server. You don't even have to involve the IT and devops groups to obtain this functionality.
Firstly, You Should Be Testing in Those Other Browsers Anyway
Functional testing of a web application should run in all of the browsers you support. That is where the problems are, after all. If you are automating tests, then you should be automating tests in those browsers. If there are issues specific to Chromium then you are not going to discover those problems by testing in PhantomJS. Similarly a clean set of tests conducted in PhantomJS should give you little to no confidence that you have ruled out all meaningful problems in other browsers.
Secondly, PhantomJS Errors are Not Actionable
PhantomJS is Not a Short Cut for Automated Functional Testing
Thus if you are automating your functional end to end testing, then sorry, you are absolutely going to have to set up Selenium servers or some similar tool for all of the browsers you support, or work with third party services such as BrowserStack or SauceLabs, and get involved with the devops and IT groups that manage the infrastructure for your build and deployment process. PhantomJS isn't a shortcut that lets you evade all of this.