Hi Hans,

the afterStep() is not missing because of an oversight. It is in fact split into several methods, one for each step outcome.

void successful(String step);

void ignorable(String step);

void pending(String step);

void notPerformed(String step);

void failed(String step, Throwable cause);

The timings of the step have already been implemented in the 4.x branch, by-passing the StoryReporter altogether. You might want to have a look at it.

Cheers

On 17/04/2014 14:38, Hans Schwäbli wrote:
Now I solved this by creating a class impleting org.jbehave.core.reporters.StoryReporter. It has enough methods which intercept the JBehave execution workflow and pass the information which I need, like scenario name. In a way this seems to be the right way to do it anyway since I am reporting the JBehave result into a test management tool. But I would be happy if you could add a method afterStep(...) into the StoryReporter interface. Because this would allow me to measure the duration of the step execution. I have workarounds for this, but they are more complicated to implement. I created a Jira task for this.


On Fri, Apr 11, 2014 at 12:48 PM, Hans Schwäbli <bugs.need.love....@gmail.com <mailto:bugs.need.love....@gmail.com>> wrote:

    Hello Mauro,
    that sounds good to use the uponOutcome, thank you! I overlooked that.
    Parsing the XML in a good way would require a XSD file I believe,
    but it does not exist, so I try not to use that approach.
    Now it looks like this:

    @AfterScenario(uponType=ScenarioType.NORMAL,
    uponOutcome=AfterScenario.Outcome.SUCCESS)
        public void afterScenarioSuccess(@Named("qc-testcase") String
    qcTestcase) {
            // TODO Export result into HP QC.
        }

    With that I can export the result in a basic way into HP QC.

    But I should also export the JBehave XML result file into HP QC.
    For this purpose I need to know which story is running. How can I
    get to that information in the method above?

    Furthermore it would be more suitable to have XML results per
    scenario since a test in HP QC (and perhaps also in many other
    test managment tools) is best represented by a JBehave scenario.
    Is it possible to configure JBehave so that it produces XML result
    files per scenario?



    On Thu, Apr 10, 2014 at 11:21 PM, Mauro Talevi
    <mauro.tal...@aquilonia.org <mailto:mauro.tal...@aquilonia.org>>
    wrote:

        @AfterScenario supports the variable uponOutcome to determine
        if the scenario has failed or not.

        Else you can parse the XML of the story and  extract the
        scenario info.


        On 10/04/2014 13:42, Hans Schwäbli wrote:

            I achieved to create Java classes which can export test
            results into HP Quality Center by using its REST interface.
            But now I wonder how to extract the outcome from the
            JBehave run so that I can export the results. I want to
            export that in a very basic way: test result with an
            attached XML report.
            I identify the tests in Quality Center by using a Meta
            info per scenario: @qc-testcase Root/Test Folder x/Test
            Set y/My Test
            This Meta info I can extract in a method like this:
            @AfterScenario
            public void afterScenario(@Named("qc-testcase") String
            qcTestcase) {}
            Each scenario shall match a test in Quality Center.
            My first idea was to export the outcome while the JBehave
            tests run. That would require to get to the information in
            a method annotated with @AfterScenario. But how can I
            determine in this method what outcome of the scenario is
            so that I can export that on-the-fly into HP QC?
            Another idea was to parse the genereated XML file after
            the run has finished. But it has no schema file. So I
            cannot generate Java classes for it by using JAXB in order
            to parse the result in a good way. Furthermore there is no
            total outcome result printed in the XML, only for the step
            outcome. Besides that I should have an XML file per
            scenario, so that I can attach it to the test result when
            I export it into HP QC, and I don't know if I can achieve
            that, so that JBehave procduces XML files per scenario.
            How would you solve that?



        ---------------------------------------------------------------------
        To unsubscribe from this list, please visit:

        http://xircles.codehaus.org/manage_email





Reply via email to