Paulo,

Well, I don't use Spring, so I couldn't use Brian's nice way... so, I developed my own API to the get system states setted. especifically for database we are using our own application's Hibernate.cfg.xml (and systems entities as well) and one special Manager.

About the Authentication, you could especialize and reuse some textual scenarios, for example: "The Manager gets Authenticated" or "Common User gets Authenticated" ...

that scenarios will never change whatever you use them.. and if you change them, is always be possible to now the effects on other stories... so, its safe to reuse... then if you will test a scenario of a process where the actor is the manager, just use GivenStory: "The Manager gets Authenticated"....

and you can create and inject (take a look on DI feature) only one AuthenticationSteps class...

About the dependence scenarios...

I'm trying to convert a old project to use Drools Flow and BPMN2... I'm getting some headakes but I 've tried some approachs... :-)

The first thing to do is to decide what do you want to test.... For example: Suppose that you have one process named BIGONE that is composed by 3 subprocesses: A -> B -> C... and it must be executed by a Common User... Depends on what you want to test will require different approachs... you can for instance write a scenario to test just A or B (generally the Human Task one).... but I want to test the BIGONE (because I can manage the dependencies more easyly)..

So my story would be (this is one of much others that could be writed). I will comment on ():


Given that X BMP server is on line (I could do that to ensure that I can open some setted URL) And the WS-HUMAN server is on line (I my case human task is controled by some web application that is at another server) And the user somemanager gets connected ok (here i could reuse that java code that will connect to my app (selenium perhapes)
And the user selects the process BigOne interface

When somemanager starts the process A (here you should explicitily call some UI method: selenium.click()) Then the system should notifies somemanager (you could right something to check you email) And should activate process B (you could open some page on BMP interface and verify it)

Given that system have executed automatic process B (You could put some timer here if want)
And system have sucessfully started process C
When user open interface BiGOne
Then system should show the message "Process executed ok"



Hope this help you... and let me know if you have any progress...

cheers

Cristiano Gavião


Paulo Sérgio Medeiros escreveu:
Thanks for the answers, I'm just learning the process. Yes Cristiano, you really got the point, maybe I'm applying BDD with Use Case mind. :-)

Ok, so in your view repeating the step description in many different scenarios/stories is not a problem, right? I'm still insisting on this point just to make sure that I'm not missing any part of how you do this. Repeating what Clements said:

Say you have AuthenticationSteps, RegistrationSteps and ApprovalSteps then I would implement @Given("I am authenticated as '<uid>' with password '<pw>'") in AuthenticationSteps (because it "fits" there ;-)) and re-use AuthenticationSteps (hence adding them to the InstanceStepsFactory call) in all three stories.

In this case, the three stories would have "Given I am authenticated as '<uid>' with password '<pw>'" in their story files and I would add the AuthenticationSteps in the InstanceStepsFactory call to reuse its exectution. Is that the right way to do?
---------------------

I have one last question. I have chosen the authentication example because it is very simple to understand. But in many applications, functionalities depends on the execution of another. How do you deal with this? For example, the request_approval story can only be executed if there is one registration request pending. Normally, we would do this by preparing the database state. But in my case, I'm not able to access the database. I have to do everything from the interface (selenium). GivenStories does make sense in this case? What are the other approaches?

Best regards,
Paulo Sergio.

On Tue, Sep 7, 2010 at 8:32 AM, Cristiano Gavião <[email protected] <mailto:[email protected]>> wrote:

    Hi Paulo,

    I agreed with Clemens...

    In my opinion, reusing things, the way you always do with OO, not
    always is a good thing when we start to think about User Stories.
    I had this kind of problem in my transition from UseCase to
    Stories. We had lots of use case diagrams in a tool and
    specification on ms word.
    The first thing that we learned was that we shouldn't write our
    story as it was a BASIC code with lots of GOTOs.(for people that
    remeber it ;-)   )...   BDD emerge from a User necessity to
    understand well the requirements...

    Other thing that I could observe is that a Uml Usecase Include
    doesn't fit well to a GivenStories... at least in our case, just
    feel ones was mantained...

    The we radically stopped to use UseCase as our capture
    requirements way, with it's Alternative " Users Crazyer" Paths,
and we started to use Stories with scenarios and JBehave... Now we have Stories that has ONLY ONE main path and Scenarios that
    are variations inside the story context...  it should be clear for
    our not technical user and for the team. User should read it,
    understand it, and sign it...

    We still use GivenStories, but only when we dont need any
    variations on the included story...

    Ok... not reusing texts maybe let us with more texts files... may
    be, but this texts could be at source control or on a wiki (being
    edited by the user himself) where we can easy track changes...

    And you have lots of way of reusing your Steps classes and others
    Java classes using the Jbehave DI feature...  It's very powerfull....


    cheers

    Cristiano

    Clemens Wyss escreveu:

            (in other words, the
            step description would be repeated in many different stories).
        why repeat? Say you have AuthenticationSteps
        RegistrationSteps
        and
        ApprovalSteps
        then I would implement Given("I am authenticated as '<uid>'
        with password '<pw>'") in AuthenticationSteps (because it
        "fits" there ;-) ) and re-use AuthenticationSteps (hence
        adding them to the InstanceStepsFactory call) in all three
        stories. Hope this makes my point clear?

            I was wondering if it would make sense to pass parameters
            in the
            GivenStories inclusion.
        Where should the parameters by applied?
        - GivenStories implies that you can specifiy multiple stories
        - what if the story has different scenarios?

            ----- Ursprüngliche Nachricht -----
            Von: Paulo Sérgio Medeiros
            Gesendet: 07.09.10 07:51 Uhr
            An: [email protected]
            <mailto:[email protected]>
            Betreff: Re: [jbehave-user] Parametrizing stories

            So, if I understood you correctly you are basically saying
            that I should not
            use the GivenStories functionality in this case and reuse
            the authentication
            steps code but not the authentication story description
            (in other words, the
            step description would be repeated in many different stories).

            Have I understood it correctly?

            I was wondering if it would make sense to pass parameters
            in the
            GivenStories inclusion. What do you think?

            On Tue, Sep 7, 2010 at 2:40 AM, Clemens Wyss
            <[email protected] <mailto:[email protected]>> wrote:

                I would keep your authentication story (with its
                examples I guess?) as is
                and create a convenience Given-step à la:
                Given I am authenticated as '<uid>' with password '<pw>'
                for request registration and request approval stories.
                Code reuse can be
                made in the step implementation of Given("I am
                authenticated as '<uid>' with
                password '<pw>'") from which you can call the
                method(s) of the
                authentication story. You could (possibly should)
                implement this convenience
                step in the AuthenticationSteps class and include it
                in the registration and
                request approval stories.

                Regards
                Clemens

                    ----- Ursprüngliche Nachricht -----
                    Von: Paulo Sérgio Medeiros
                    Gesendet: 06.09.10 22:01 Uhr
                    An: [email protected]
                    <mailto:[email protected]>
                    Betreff: [jbehave-user] Parametrizing stories

                    Hi,

                    I'm testing an workflow application where many
                    stories are dependent on
                    others.

                    Thus, there are many cases where two stories
                    depend on the same story but
                    with different parameters.

                    One very simple example is the stories that depend
                    on the login story.
                The
                    following case illustrate the scenario:

                    request_registration() -> authentication(user1,pass1)
                    request_approval() -> authentication(manager1,pass2)

                    '->' represents the dependency relationship
                    between stories and the
                    parenthesis represent the parameters passed from
                    one story to another.
                    So, in the example above, the story
                    request_registration depends on the
                    authentication story passing two parameters (a
                    user and his password).
                Note
                    that the request_approval story also depends on
                    the authentication story,
                    but with different parameters.

                    Does any one have this same need? Does jbehave
                    already implements
                something
                    that can be used to get this behavior?

                    Thanks!
                    Paulo Sérgio.
                
---------------------------------------------------------------------
                To unsubscribe from this list, please visit:

                http://xircles.codehaus.org/manage_email





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

           http://xircles.codehaus.org/manage_email



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

      http://xircles.codehaus.org/manage_email




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

   http://xircles.codehaus.org/manage_email


Reply via email to