viernes, enero 24, 2014

Reporting JBehave results in AsciiDoc format.


JBehave is a framework for Behaviour-Driven Development (BDD). BDD is an evolution of test-driven development (TDD) and acceptance-test driven design, and is intended to make these practices more accessible and intuitive to newcomers and experts alike. The core of JBehave from the point of view of end users are user story files, where we define stories that our product should meet to validate that we are aligned with what our client wants. These stories are run every time a change has done in the project, so we can still ensure that nothing has been broken and we are still delivering the right thing. To validate this, a report is generated by JBehave so we can inspect the result of all stories and be sure that all is ok and if there is something wrong, which stories and why they have failed. By default the formats supported by JBehave are TXT, HTML or XML

With the advent of markup languages for writing documentation, it has sense to be able to embed this reports inside our documentation system, because the result of a build should be considered as documentation too so everyone involved directly or indirectly on the project can review the real state of the project. One of the trending markup language nowadays is AsciiDoc (and Asciidoctor). It is for this reason that I have developed a JBehave report extension so reports are written in AsciiDoc format and consequently be embedded inside another AsciiDoc document.

Let's see an example of a report generated using AsciiDoc reporter, then the report of story is included inside a master AsciiDoc document and finally rendered using Asciidoctor to HTML.


The first part of the document we can see the story that is being executed (calculator_mult_stories.story). Just below we can see the result of the story in one sentence and with an icon. In this case there is one failure in one step (see below) so an ambulance icon is used. If there would be no errors then a green rocket is used, and if any pending or ignored steps then a yellow lorry is used. After that, description, meta-information and narrative data about story is printed. Then given stories of this story is printed with the result of all of them. In this case one given story has been executed and his scenario has just passed correctly.

Note that you can navigate to the result of a given story by simply clicking on the link provided in Given Stories information section.

And the document continues with:

After user stories the scenarios of current story are printed with their results. In this example as in previous one note that examples are used and are shown as a table. Finally all steps executed with its result are printed. Note that the final step have just failed and the cause of the error is shown.

So as you can see you can embed test result inside another AsciiDoc document and make them look clear for anyone who wants to review the state of the project.

But now let's see how to use AsciiDoc reporter inside JBehave.

Reporter is released on bintray, so the first thing is to add as repository maven bintray.

Then we can add the dependency on our project:

And now we can configure StoryReporterBuilder with adoc format.

And that's all, now when you run JBehave your reports will appear on output directory as HTML or TXT but also  as AsciiDoc.

We keep learning,
Alex.
He's the guy who's the talk of the town, with the restless gun, don't shoot broad out to fool him around (Lo chiamavano Trinità - Annibale E I Cantori Moderni)
Music: https://www.youtube.com/watch?v=w5HkxTLp5jA 


11 comentarios:

rmannibucau dijo...

Hey

Cool feature, is it planned to do the same for cucumber-jvm and cukeinspace?

Unknown dijo...

Yes I am thinking to use similar layout for cucumber. But first I am going to focus on releasing asciidoctor 1.5.0, and then I will start with cucumber extensions, which I will need it for a demo of Arquillian / Arquillian-CuckesOnSpace

Unknown dijo...

Reporting JBehave results in AsciiDoc format : ambulance image and thumb up image not coming in report. Please Help.

Unknown dijo...

What version of asciidoctor are you using to render AsciiDoc to html?

Anónimo dijo...

Cool feature. I did not use such types of feature sbefore. I must say it's a nice effort. I wish one day students can find the BEST ASSIGNMENT WRITING SERVICE UK which will be worthy for every student. I hired an assignment writer for my assignment but i did not get satisfied with his work. Let's hope for good.

The Assignment Help Nz dijo...

I was really caught aback when I finished reading it. I'm interested in learning more about relevant topics such as Write My Essay UK - Buyessay.org.uk.

Kiro Wadazo dijo...
Este comentario ha sido eliminado por el autor.
Kiro Wadazo dijo...

There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game. Both boys and girls feel the impact of just a moment’s pleasure, for the rest of their lives.

Rohitab.com
Information
Click Here
Visit Web

Cial Fseal dijo...

You have a great blog here! would you like to make some invite posts on my blog?

Forum.mubz.bg
Information
Click Here
Visit Web

Unknown dijo...

The "One Jar To Rule Them All" is a great idea for people who are looking for a way to declutter their homes. It can be helpful to have one place to store all of your belongings, especially if you live in a small space. There are a number of cheap assignment writing service UK available in the UK. These services can be a great option for students who are struggling to keep up with their schoolwork. However, it is important to do your research before choosing a service, as not all of them are created equal.

it company dijo...

In conclusion, the Lewes taxi service plays a multifaceted role in the fabric of this historic English town. Beyond providing mere transportation, taxis contribute to Lewes's mobility, accessibility, economy, and cultural identity. As Lewes continues to evolve and grow, it is imperative to recognize and celebrate the invaluable contributions of taxi services, ensuring that they remain an integral part of the town's landscape for years to come. Whether it's a leisurely ride through the scenic countryside or a quick trip to the local market, the humble taxi embodies the spirit of Lewes, embodying its ethos of community, connectivity, and charm.