Giter Site home page Giter Site logo

junit-parser's Introduction

Naroga\JUnitParser

  1. Installing

To install this bundle, use composer:

composer require naroga/junit-parser

Alternatively you can add the following to your composer.json:

"require" : {
    "naroga/junit-parser": "dev-master"
}

Remember to run composer update afterwards.

  1. Usage

Using this bundle is pretty straightforward. Get a JUnit report and tell the parser to parse it.

use Naroga\JUnitParser\Parser;

$parser = new Parser($FILE_PATH_OR_XML_CONTENT);
$parser->parse('html'); //Returns HTML result.
$parser->parse('text'); //Returns a plaintext result.

You can also parse multiple xmls to the same report:

$parser = new Parser;
$parser->addXmlContent($report1);
$parser->addXmlContent($report2);
$parser->addFileContent($file_with_report3);
$parse->('html'); //Returns a single HTML result, with the sum of all reports.
  1. Extending the templates

TBD.

junit-parser's People

Stargazers

 avatar

Watchers

 avatar

Forkers

pharaohtools

junit-parser's Issues

Parse returns a file path

Hi there, I think my issue may be that I do not know Twig well. When I run the parse method I get a string back of a file path, where I was expecting html. I'm writing a small script to read junit xml and output html using the library.

``use Naroga\JUnitParser\Parser;

$all_files = scandir($source) ;
foreach ($all_files as $one_file) {
if (!in_array($one_file, array('.', '..'))) {
$file_content = file_get_contents($source.$one_file) ;
if (!isset($parser)) {
$twig = new \Twig_Environment(new \Twig_Loader_String());
$parser = new Parser($twig, $file_content);
} else {
$parser->addXmlContent($file_content);
}
}
}

$html = $parser->parse('html'); //Returns HTML result.
var_dump($html);
file_put_contents($target, $html) ;
``

At the point of the var dump, I get /path/to/project/vendor/naroga/php-junit-parser/Resources/view/report.html.twig . Could you please tell me what I've done wrong? Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.