PHPackages                             detro/phantomjs-jasminexml-example - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. detro/phantomjs-jasminexml-example

ActiveLibrary[Testing &amp; Quality](/categories/testing)

detro/phantomjs-jasminexml-example
==================================

A phantomjs / jasminexml Javascript Testing example

414.0k22JavaScript

Since Mar 2Pushed 11y ago5 watchersCompare

[ Source](https://github.com/detro/phantomjs-jasminexml-example)[ Packagist](https://packagist.org/packages/detro/phantomjs-jasminexml-example)[ RSS](/packages/detro-phantomjs-jasminexml-example/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

---

**WARNING - WARNING - WARNING**
===============================

[](#warning---warning---warning)

When I wrote this the intention was to release an example of integration between PhantomJS, Maven and Jasmine. I had no desire to maintain another project, and I find it surprising how many refer to this as one.

Use this as inspiration, and then take off your way. I have closed the Issue Tracker.

*P.S.: Yes, I should have probably released this as a Gist instead...*

---

PhantomJS - Jasmine XML - Example Project Layout
================================================

[](#phantomjs---jasmine-xml---example-project-layout)

Description
-----------

[](#description)

This is an example project layout, that realises JavaScript Unit Testing using [Jasmine](https://github.com/pivotal/jasmine) on the top of [PhantomJS](https://github.com/ariya/phantomjs).

It is designed to be used *standalone* or *within Maven*.

Should work properly with **PhantomJS version `>=2.2.0`**.

Use Standalone
--------------

[](#use-standalone)

```
$ phantomjs test/phantomjs_jasminexml_runner.js test/test_runner.html xml_output_dir/

```

This will produce a set of XML outputs, one for every Jasmine Test Suite.

Use within Maven
----------------

[](#use-within-maven)

The project *already* provides a `pom.xml` that does the trick. So a simple:

```
$ mvn test

```

or

```
$ mvn clean install

```

will launch the tests and, if they all pass, make the mvn build pass. If any test fails, the mvn build fails.

Internals
---------

[](#internals)

Well, explaining the internals of PhantomJS here is pointless, but to understand how this works, you need to understand a simple idea: PhantomJS provides a main "Javascript Context" from within which, the user is able to *spawn* a WebPage, effectively creating another "Javascript Context".

The new context has the following characteristics:

- **isolated** - the page doesn't know anything about phantom and phantom API
- **controllable** - the main phantom context provides API to control/influence the page context

### So, how does it work?

[](#so-how-does-it-work)

The *magic* is done by 2 scripts:

```
test/phantomjs_jasminexml_runner.js
test/lib/jasmine-reporters/jasmine.phantomjs-reporter.js

```

`jasmine.phantomjs-reporter.js` is a *plugin* for Jasmine that saves the result of the tests at the bottom of the webpage where the test runs.

`phantomjs_jasminexml_runner.js` instead runs the show, launches the tests, extracts the result from the page, then saves it to the directory passed (see source).

**Happy Testing ;-)**

Licensing: Public Domain
------------------------

[](#licensing-public-domain)

The code of this project is relased under [Public Domain](http://en.wikipedia.org/wiki/Public_domain) and as such you are not required to do anything but use and enjoy it.

If, out of good will, want to put somewhere in your work a reference to this project as "inspiration", please feel free. But don't feel any obligation to do so.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4e2f432db40584f8cf92a1151e95967c0af440a1d7b1f14656e5cf42995b4e5?d=identicon)[jvanbouchaute](/maintainers/jvanbouchaute)

---

Top Contributors

[![detro](https://avatars.githubusercontent.com/u/114508?v=4)](https://github.com/detro "detro (23 commits)")[![kmahara](https://avatars.githubusercontent.com/u/4443732?v=4)](https://github.com/kmahara "kmahara (3 commits)")[![adam-lynch](https://avatars.githubusercontent.com/u/1427241?v=4)](https://github.com/adam-lynch "adam-lynch (1 commits)")[![jvanbouchaute](https://avatars.githubusercontent.com/u/2338344?v=4)](https://github.com/jvanbouchaute "jvanbouchaute (1 commits)")

### Embed Badge

![Health badge](/badges/detro-phantomjs-jasminexml-example/health.svg)

```
[![Health](https://phpackages.com/badges/detro-phantomjs-jasminexml-example/health.svg)](https://phpackages.com/packages/detro-phantomjs-jasminexml-example)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M360](/packages/dms-phpunit-arraysubset-asserts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
