Brent Barker | 12 Dec 19:48 2014
Picon

GivenStories in the middle of a scenario

Is it possible to run a GivenStories in the middle of a scenario?

My use case is, there are parts of the application that has steps that need to be performed to get to the correct area, but the test in that area is the same. Then, there are some steps afterwards that needs to be performed.


It would be easy to do it in two different scenarios, but the tricky part is that this needs to be performed for several different users, logging in via an examples table.

A thought is I could use composite steps to perform the required action, so I don't have to have a ton of duplicate copy/past steps in the various story files that need to perform this check. However, it is nice to see the actual steps taken in the story file.
Siaynoq | 19 Nov 04:29 2014
Picon

Changing candidateSteps while running a story

Dear JBehave Devs,

My question is simple (I hope): is it possible to change candidate steps (defined by useCandidateSteps() ) while a story is running? 

The reason is a bit more complicated: we have "cross-domain" testcases (e.g. doing something on a webpage then opening an iPhone app, going back to the webpage) - and the steps for these domains are separated by using different candidateSteps while starting up the framework.
Obviously while we switch to a different domain, we need those steps only...

An example scenario (not actual functionality):

Given I'm on the admin page for the customers
When I disable the login for User_A
And I switch to the iPhone app  //this would change the steplibrary?
And I log in                             //this step exists in both domains!
Then I get the error message: "Your login is disabled"

My guess is to do some magic in the Embedder, but maybe you know a more elegant solution.

As an additional info: we are using a specialised framework, so we can do "anything" - if this is possible at all.

I know it is not a good practice to mix different domain and business logic, but in a lot of cases this would give us more broad coverage while keeping the 

Regards,

Zoltan
Ireneusz Kordal | 17 Nov 23:05 2014
Picon

How to append additional lines to the report

Hi,

Is there a way to include in a report some additional lines of text 
passed from inside of step methods ? Most of our test are using some 
dynamic parameters generated by the application during runtime (unique 
case numbers, barcode numbers etc.), and I want to show these values in 
the report, so testers can easily see them directly on the report, and 
don't have to search through log files to find them (actually we are 
loging this information using log4j).
Some kind of functionality that they have in Thucidides: 
http://thucydides.info/docs/thucydides-one-page/thucydides.html#_using_step_methods_to_document_test_cases

For example:
Given A customer send us a request
When I scan a document on the scanner
And .........

 <at> Given("A customer send us a request")
public void a_customer_send_request(){
   String requestNumber = generateReuest();
   appendToReport("Request number is " + requestNumber );
   ...
}

 <at> When("I scan a document on the scanner")
public void i_scan_a_document(){
   String barcodeNumber = scanNewDocument();
   appendToReport("Barcode number is " + barcodeNumber );
  ...
}

And a final report might look like this:

Given A customer send us a request
    ==> Request number is 12345
When I scan a document on the scanner
    ==> Barcode number is 5554567

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

    http://xircles.codehaus.org/manage_email

Simon Kent | 10 Nov 18:30 2014

Version 3.9.5 Only displays last story duration in report view?

Hi


We were testing out an upgrade to JBehave 3.9.5 and noticed that our story reports only showed the duration of the last story run (we run all tests in one class).

On examination it looks like the write method in StoryManager always created a new durations file (see extract below). This is presumably the change for JBEHAVE-1041.

In previous versions (we were using 3.7.5) the report correctly showed the durations for all the stories.




  private void write(Properties p, String name) {
        File outputDirectory = configuration.storyReporterBuilder().outputDirectory();
        try {
            Writer output = new FileWriter(new File(outputDirectory, name));
            p.store(output, this.getClass().getName());
            output.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


Simon Kent
QA Manager
T: 01454 802431
E: skent-/VcaexCmnNCP2YhJcF5u+vpXobYPEAuW@public.gmane.org
Privileged or confidential information may be contained in this message. If you are not the addressee of this message please notify the sender by return and thereafter delete the message, and you may not use, copy, disclose or rely on the information contained in it. Internet e-mail may be susceptible to data corruption, interception and unauthorised amendment for which Gresham does not accept liability. Whilst we have taken reasonable precautions to ensure that this e-mail and any attachments have been swept for viruses, Gresham does not accept liability for any damage sustained as a result of viruses. Statements in this message that do not relate to the business of Gresham are neither given nor endorsed by the company or its directors. Gresham Computing plc Registered in England and Wales. Company No. 01072032 Registered Office: Aldermary House, 10-15 Queen Street, London, EC4N 1TX. Further information about Gresham Computing can be found on our website: www.gresham-computing.com
Brent Barker | 29 Oct 22:08 2014
Picon

Restarting Stories

Hi again,

Is there a way to restart a story if it has failed once before? I know there is a way to restart a scenario by throwing a RestartingScenarioFailure exception.

This would be useful for our selenium tests. There are countless things that can go wrong when running these browser tests. Since a false positive can cause people to quickly lose trust in the tests, others advised that this would be a good solution.

Thanks in advance!
-Brent
Zheng, Ayesha(AWF | 15 Oct 05:27 2014
Picon

Issue about GivenStories & Examples

Hi all,

 

I have a problem about GivenStories.

 

Assume A.story has 2 or more scenarios:

Scenario: A - 1

Meta: <at> id1 scenario1

Given actions with <Apara1>

When …

Examples:

|Apara1|

|value1|

 

Scenario: A-2

Meta: <at> id2 scenairo2

Given …

Examples: A2.table

 

 

 

B.story want to run only scenario A-1 for prepare with different data.

B.story:

Scenario: B - 1

GivenStories: A.story#{id1:scenario1}#{0} à Problem here.

Given actions with <Bpara1> and <Bpara2>

When …

Examples:

|Bpara1|Bpara2|Apara1|

|value1|value2|value3|

 

 

 

My problem is:

How can I use givenStories to match follow requirements:

1.       Run only Scenario A-1 in A.story.

2.       Pass data in Table Row 0 to givenStories A-1.

3.       Run Scenario B-1 with example data.

 

Thanks very much.

 

 

Best Regards,

Ayesha

 

kvitaliy | 9 Oct 12:15 2014
Picon

Examples and GivenStories

Hi All,

I have a problem with understanding of how to use GivenStories.

Assume, we have story file UserLogin.story with next text:

Scenario: user login
Meta:  <at> id1 userLogin

Given the user click on login button
When the user type '[login]'
AND the user type '[password]'
AND the user click on '[btn]'
Then something happens

Examples:
|login|password|btn|
|uloginrole1|upass|Login|
|uloginrole1|upass|Cancel|
|uloginrole2|upass|Login|
|uloginrole2|upass|Cancel|

Also, we have story in another file:

Scenario: scenario name

GivenStories: path/to/UserLogin.story

Given <<given conditions c1,c2,...,cK>>
When <<user actions with params p1,p2,...,pN>>
Then <<expectations e1,e2,...,eM>>
Examples:
|c1|c2|...|cK|p1|p2|...|pN|e1|e2|...|eM|
|c11|c21|...|cK1|p11|p21|...|pN1|e11|e21|...|eM1|
|c12|c22|...|cK2|p12|p22|...|pN2|e12|e22|...|eM2|
...............................................

So, two questions:
1. How can I run this scenario only for first row from given story 
(|uloginrole1|upass|Login|)?
2. Is it possible to run UserLogin as precondition only (i mean, i don't 
want to run it outside scenarios, which depends on it)?

Thanks.

Best regards,
Vitaliy

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

    http://xircles.codehaus.org/manage_email

Dariusz Lorenc | 8 Oct 03:05 2014
Picon

Re: JBehave, maven and slf4j

Thanks for a quick reply. Really appreciate it.

I didn't know the jbehave is not using any logging framework. Now I'm really puzzled. Wonder if any of the jbehave's dependencies could cause that issue.

I did try with the logback dependencies at the plugin level, as you suggested. Unfortunately it didn't help at all.

I'm attaching a sample project which reproduces the issue. Hope it goes trough as an attachment. Just unzip it and run mvn integration-test.

You should see something like this, when it fails:

Then it should be a Logback instance (FAILED)
(org.junit.ComparisonFailure: expected:<[ch.qos.logback.classic.]Logger> but was:<[org.slf4j.impl.Simple]Logger>)

As you would see there is not much in that project. There is a unit test (LogTest) which check for the right Logger class name. And that seems to always pass. 
The LogShouldNotMisbehaveSteps class obtains logger in one step and asserts Logger's class name in another step. And that seems to fail when run from maven, but passes when run as junit from the IDE.

Give it a go, and please let me know if you find anything interesting. 

Cheers,
Dariusz

On Tue, Oct 7, 2014 at 6:14 PM, Mauro Talevi <mauro.talevi <at> aquilonia.org> wrote:
There's nothing dodgy about log-related in JBehave, simply because there is no logging framework used.

What's usually quite dodgy is the logging frameworks' classloading and dynamic lookups, which don't play well with Maven's rather strict classloading.

To overcome classloading issues, it should suffice to declare your logging framework's dependencies at plugin level, rather than project level: 

http://jbehave.org/reference/stable/maven-goals.html

If it doesn't work then please us send a sample project that reproduces the issues.

Cheers

 
On 07/10/2014 03:44, Dariusz Lorenc wrote:
Hi,

I've been trying to get JBehave (3.9.4) to work in one of my projects, but I'm experiencing some odd behaviour with the slf4j binding. Hope somebody can help to pinpoint it, and confirm, or deny, that JBehave, or its maven plugin is a culprit here.

I'm using dropwizard (0.7.1) in my project which in turn uses logback, and comes with all the logback dependencies as well as slf4j-api etc. Based on that, Dropwizard seems to assume that org.slf4j.LoggerFactory.getLogger(...) would always return an implementation of ch.qos.logback.classic.Logger (they cast the result to that Logger type).

I have a very simple JBehave test, which tries to start up the service (dropwizard). When I run it from eclipse, everything works fine. However when I run it from maven, when dropwizard's service is starting up, I'm getting an exception like this: 

Caused by: java.lang.ClassCastException: org.slf4j.impl.SimpleLogger cannot be cast to ch.qos.logback.classic.Logger
at io.dropwizard.logging.LoggingFactory.bootstrap(LoggingFactory.java:37)
at io.dropwizard.logging.LoggingFactory.bootstrap(LoggingFactory.java:31)
at io.dropwizard.Application.<clinit>(Application.java:20)
That is caused by the dropwizard code trying to do that cast. For some reason, in that scenario only, slf4j's getLogger returns org.slf4j.impl.SimpleLogger. I checked my classpath/dependencies to make sure I don't include the slf4j-simple jar anywhere. The only slf4j bindings I have is the native logback implementation, which comes with dropwizard. No slf4j-simple jar, no org.slf4j.impl.SimpleLogger on my classpath. So how come it shows up in the runtime when running from maven?

I even tried to strip the project down completely. I removed dropwizard, and just left slf4-api, logback and jbehave. The JBehave test was modified to just print out the class name of the logger retrieved by the same getLogger method.
And same result again - SimpleLogger (slf4j-simple) when running from maven, logback logger when running from the IDE.

To prove it's somehow JBehave related, I created a plain junit test (no jbehave), which just prints out the logger's class name. It always returns the right logback Logger, when run from eclipse or maven.

So it seems to be only maven-JBehave combination which always results with slf4j-simple binding. That makes me think that JBehave (or actually its maven plugin) could be doing something (dodgy?) log related under the hood. Could somebody confirm that? And if so, does anybody know a good workaround? Apart from Cucumber, of course :)

Any help is much appreciated.

Thanks,
Dariusz


Attachment (logmisbehave.zip): application/zip, 8 KiB

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

    http://xircles.codehaus.org/manage_email
Brent Barker | 25 Sep 22:21 2014
Picon

AfterScenario execution

Hi again,

I noticed from upgrading JBehave 3.9.2 to 3.9.3, the order which AfterScenario was executed changed.

Our method annotated with <at> AfterScenario() takes a screenshot of the failure in the scenario, and continues on to the next scenario.

A story with this:
Lifecycle:
After:
Outcome: ANY
Given I login as a Admin
Then I am able to clean up my data

It used to take a screenshot (executing the <at> AfterScenario()) before performing the after lifecycle steps. In 3.9.3, this is no longer the case

Is there some documentation regarding the order lifecycle steps should be executed, depending on failures?

If it helps, I can try to put together an example project that demos this behavior.

Thanks!
-Brent
Zheng, Ayesha(AWF | 19 Sep 11:23 2014
Picon

Parametrised scenario problem

Hi all,

 

I have a scenario:

 

Given a user open homepage

Then should see <message1>

When user do something and go to another page

Then should see <message2>

Examples:

test.table

 

 

And test.table with content:

|message1|message2|

|Welcome|Hello|

 

And step “Then should see <message1>” and “Then should see <message2>” do the same thing: just check the text.

So I just want to implement it once time.

Code like:

<at> Then("should see <message>")

public void shouldSeeMsg( <at> Named("message")String message)

{

    // check text…

}

 

When running this case, I hope it can match both step “<message1>” and “<message2>”.

But the problem is, I found the parameter name in code must be the same with the name specified in scenario.

These steps always in PENDING status.

 

Could anyone help to how to solve this?

Thanks very much.

 

Best Regards,

Ayesha

 

Hans Schwäbli | 17 Sep 09:33 2014
Picon

CTRL+F does not work in JBehave editor

As it seems CTRL+F for searching text does not work inside the JBehave editor.
 
What do you think, would that be a good idea to add that feature to the JBehave editor?

Gmane