Victor,
I have a case like yours using a web application implemented using an
especific framework.
What we decided to do was to create text templates for our commons
storys(CRUD and other common UI pattern) in a high level way.
This way my end user do not need to bother with interfaces details.. and
I can reuse all pojos with the steps behind scenes..
And for the lower level steps, we use PageObject pattern (generic pojo
classes with selenium stuffs that match each implemented Web Page).
Ah, to help our lower level steps know what to do, we have created a
webservice(integrated with our ALM tool) that supply details, at
execution time, to the Steps pojos about specifications artifacts: user
interfaces, business rules, process, entities and other stufs ...
this way we can guarantee, for example, that an inteface was developed
using the right name, with all buttons, using the right color, etc....
using your example, I could created a story like this:
Story: Ensure that user can create a emergency report
Given that user X is logged in
And "Emergency Report" is the current openned form
When user fill the "main" form with:
|Date|Info2|Info3|
|today|blabla|bleble|
Then the system should show the report "Emergency Report" on screen
And should send the report "Emergency Report" to user email
And create a EmergencyReportSteps class that could be inherited from(or
associate to) a ReportSteps class which has the core report test stufss..
cheers
Cristiano
Victor Moura escreveu:
I'll try to explain our case to see if you understand.
We use JBehave for both GUI and Web tests. And we are planning to test
a fairly big application.
In our GUI application this feature would be better understood.
We test our Java application with Jemmy, to validate Swing components.
The idea is that we create, incrementally, higher level steps like
so...
Lower level: Create Steps for manipulating the Swing components.
Something like "When i click the radio button" or "When i fill the
textbox with "text""
Upper level: Use the lower level steps to describe higher level
behavior of our application, virtually creating our own language to
manipulate its functionalities. (The idea is that we need to code less
and describe more after creating a fairly rich amount of steps)
An example: "When I create an emergency report" (this step would be
translated like so)
@When ("I create an emergency report")
@Given ("I am logged in")
@Given ("I click the emergency button")
@Given ("I fill the emergency form")
@Given ("I click the "generate emergency report" button")
@Then ("the report should be created")
It can be a very helpful feature, in my opinion.
On Thu, Aug 19, 2010 at 5:04 PM, Mauro Talevi
<[email protected]> wrote:
This behaviour is not supported at the moment.
But what is the use case for having the precondition specified at step level
rather than at beginning of scenario?
On 19/08/2010 22:01, Eduardo David wrote:
Ok,
But what is I want to use a GivenStory as one middle step in my scenario?
Something like:
Given stepOne
And stepTwo
AndStoty path/to/story.
...
And stepN
Then ...
Regards,
Eduardo
On Thu, Aug 19, 2010 at 4:55 PM, Mauro Talevi <[email protected]>
wrote:
You can use GivenStories to define preconditions to entire scenarios,
not just to a single step.
Scenario: A scenario that depends on other scenarios
GivenStories /path/to/a/precondition/story
When I do something that depends on precondition
Then I'm successful
On 19/08/2010 21:48, Victor Moura wrote:
Hi,
Not really. I would like something like this
# ruby
Given /^a document exists with content$/ do |pystring|
Given "I go to add a document"
And 'I fill in "ditacontent" with', pystring
And 'I press "Add to repository"'
end
In this code, the step "Given a document exists with content" is being
defined. What this step does is call theese 3 inner steps that are
defined somewhere else.
On Thu, Aug 19, 2010 at 4:45 PM, Mauro Talevi
<[email protected]> wrote:
JBehave supports alias annotations to reference the same method with
different language patterns.
Is this what you mean?
Cheers
On 19 Aug 2010, at 16:30, Victor Moura <[email protected]> wrote:
Hi,
Is there a way to, when defining a step, use a step alteady defined
(not by calling the method)? Something like is done in Cucumber, like
the following
When /I log in the site with the login "(.*)" and password "(.*)"/ do
| login, passwd | // This is the step that we want to define
When /I fill the field "txtLogin" with "login" // This step,
was defined somewhere else, and will be called inside the step we are
defining now
When /I fill the field "txtPassword" with "passwd" // Calls the
same step as the above, using different parameters
end
The idea is that we can define "higher level" steps independent of the
method we define in java, and that the legibility of those higher
level steps we are defining is greater that what we get when using
something like (in JBehave)
@When "I log in the site with the login \"$login\" and password
\"$passwd\"
public void doLogin(String login, String passwd) {
fillTextField("txtLogin", login); // this method is defined as a
step somewhere else
fillTextField("txtPassword", passwd);
}
You see, it looks pretty much the same, but I like the idea of being
able to make the steps more reusable, independent and legible.
Thanks in advance.
--
Victor Moura Cortez
---------------------------------------------------------------------
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