Carlos Silva | 31 Jan 20:29
Favicon

Not ignoring failures in GivenStories

Hi I'm trying to stop the execution of my story steps (mark as pending) whenever there is a failure in any of my GivenStories I know that I can set doIgnoreFailureInStories to true but this will not run all my other stand alone stories and I only want to stop execution when any given story fails. Any help appreciated.
Simon Kent | 26 Jan 12:16

Capturing ScreenShots on failure

Is there an easy way to hook into step failures to capture screen 
shots?  We are running JBehave 3.5.4.

--

-- 
Simon Kent
QA Engineer
Gresham Computing PLC
e: skent <at> gresham-computing.com

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: Sopwith House, Brook Avenue, Warsash, Southampton. Hants. SO31 9ZA
Further information about Gresham Computing can be found on our website: www.gresham-computing.com 
Marcin Zajączkowski | 20 Jan 21:03
Picon
Favicon

How to make Surefire to see embedder-based tests as JUnit tests?

Hi,

I would like to have a JBehave tests run via maven surefire plugin as the simple JUnit tests. By default
surefire doesn't recognize my test classes as JUnit tests. In case of extending JUnitStory/Stories I
could override run method and add @Test annotation, but what can I do using embedder-based method like below?

@RunWith(SpringAnnotatedPathRunner.class)
@Configure
@UsingEmbedder
@UsingSpring(resources = {...})
@UsingPaths
public class MyStoriesTest {
}

Regards
Marcin

--

-- 
http://blog.solidsoft.info/ - Working code is not enough

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

    http://xircles.codehaus.org/manage_email

Dave Carey | 18 Jan 13:46
Picon

Parameterizing GivenStories for repeating Examples

JBehave provides a nice feature for parameterizing sceanrios to allow repeating tests.  As shown in the documentation:-

Given a stock of <symbol> and a <threshold>
When the stock is traded at <price>
Then the alert status should be <status>
 
Examples:    
|symbol|threshold|price|status|
|STK1|10.0|5.0|OFF|
|STK1|10.0|11.0|ON


I was hoping to trying to extend its use in combination with a Given Story.

To demonstrate by means of extending the documentation example:-

I want to extend it to support a  GivenStory that selects the current StockExchange 
Now the first example would be 'Nasdaq'  and the second 'FTSE'.  

The hypothetical configuration might then be:-

GivenStories: acme/givenstories/SelectAStockExchange.story
Given a stock of <symbol> and a <threshold>
When the stock is traded at <price>
Then the alert status should be <status>
 
Examples:    
|stockExchange|symbol|threshold|price|status|
|NASDAQ|STK1|10.0|5.0|OFF|
|FTSE|STK1|10.0|11.0|ON

When trying this I found that the 'GivenStory'  did not inherit the parameterized variables.
The alternate was to use the anchor tag

e.g. 
GivenStories: acme/givenstories/SelectAStockExchange.story{0}

but now the example parameters are not available to my parent story AND I can only pass in one row to the given Story rather than repeating the test.

Is there any recommendation on how achieve the desired behaviour?

thanks
Dave
Christian Taylor | 17 Jan 14:06
Picon

Absence of action as action?

I often encounter a strange issue that our developers comment on.
Can the absence of action be used as an action?
Shouldn't the scenario be re-written if that is the case?

An example:

Upload of data to a device that is configurable to close the file if the 
connection is idle for X seconds.

Scenario: File is closed or remains open depending on duration of 
idle-time
Given device configured with idle-time 5 seconds
And connection is active
When connection is idle for <idle> seconds
Then file is <file-state>

Examples:
| idle | file-state |
| 4    | open      |
| 6    | closed    |

But obviously, the When is not "really" an action as such.

So, shouldn't it be re-phrased so the action is the change in state, 
instead of the duration of a certain state?

How do others deal with this issue - is it even an issue?

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

    http://xircles.codehaus.org/manage_email

Carlos Silva | 10 Jan 21:54
Favicon

Unable to run GivenStories

I'm trying to use the GivenStories feature of jbehave-core-3.5.1 but the
story using it always shows as pending. My story runs fine when not using
GivenStories and including the steps directly in the story. Any help would
be greatly appreciated.

My story:

In order to try out the magnum product,
As a potential customer,
I want to be able to register for a test drive account.

Scenario: successfully registers for test drive

GivenStory: register_for_test_drive.task

Meta:
@type positive
@component test-drive
@suite acceptance
@level 1

My story has no steps as I just want to call the GivenStory steps, in the
same directory I have register_for_test_drive.task with a simple step as
follows:

Given the user opens the testdrive-registration web page

Here is how my stories are configured: TestDriveStories.java

package com.symantec.automation.testdrive.stories;

public class TestDriveStories extends JUnitStories {

private WebDriverProvider driverProvider = new PropertyWebDriverProvider();
  private WebDriverSteps lifecycleSteps = new
PerStoryWebDriverSteps(driverProvider);
  private Pages pages = new Pages(driverProvider);
  private SeleniumContext context = new SeleniumContext();
  private ContextView contextView = new LocalFrameContextView().sized(500,
100);

  public TestDriveStories() {

configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecutor())
;
    configuredEmbedder().useMetaFilters(asList("-ignore"));
    configuredEmbedder().embedderControls()
        .doIgnoreFailureInStories(true)
        .doIgnoreFailureInView(false)
        .doGenerateViewAfterStories(true);
  }

  public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    return new SeleniumConfiguration()
        .useSeleniumContext(context)
        .useWebDriverProvider(driverProvider)
        .useStepMonitor(new SeleniumStepMonitor(contextView, context, new
SilentStepMonitor()))
        .useStoryLoader(new LoadFromClasspath(embeddableClass))
        .useStoryReporterBuilder(new StoryReporterBuilder()
            .withRelativeDirectory("reports/tests/functional/jbehave")
            .withCodeLocation(codeLocationFromClass(embeddableClass))
            .withDefaultFormats()
.withFormats(CONSOLE, WebDriverHtmlOutput.WEB_DRIVER_HTML));
  }

  public InjectableStepsFactory stepsFactory() {
    Configuration configuration = configuration();
    return new InstanceStepsFactory(configuration,
        new TestDriveSteps(pages),
        lifecycleSteps,
        new WebDriverScreenshotOnFailure(driverProvider,
configuration.storyReporterBuilder()));
  }

  protected List<String> storyPaths() {
    return new StoryFinder()
        .findPaths(codeLocationFromClass(this.getClass()).getFile(),
asList("**/*.story"), null);
  }

  // This Embedder is used by Maven or Ant and it will override anything
set in the constructor
  public static class SameThreadEmbedder extends Embedder {
    public SameThreadEmbedder() {
      useExecutorService(MoreExecutors.sameThreadExecutor());
    }
  }

}

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

    http://xircles.codehaus.org/manage_email

Mauro Talevi | 5 Jan 15:01

Re: jbehave with testng

Pull latest trader example and you'll find a TestNGTraderStories class 
which you can run via TestNG.

http://jira.codehaus.org/browse/JBEHAVE-698

On Thu Jan  5 14:27:05 2012, Graham Abell wrote:
> Thanks, I'd read that alright... I thought one of the samples might
> include it's usage but not to worry :)
>
> On 5 January 2012 13:21, Mauro Talevi<mauro.talevi@...>  wrote:
>> You can easily support TestNG, as described here:
>> http://jbehave.org/reference/stable/faq.html
>>
>>
>> On Thu Jan  5 12:15:04 2012, Graham Abell wrote:
>>>
>>> Hi All,
>>>
>>> is there a working example of jbehave integrated with testng?
>>>
>>> thanks!
>>> graham
>>>
>>> ---------------------------------------------------------------------
>>> 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

Graham Abell | 5 Jan 12:15
Picon
Gravatar

jbehave with testng

Hi All,

is there a working example of jbehave integrated with testng?

thanks!
graham

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

    http://xircles.codehaus.org/manage_email

Sheldon | 4 Jan 19:37
Picon

Can I reuse stories with two different implementations?

I am using JBehave in a project where we test http requests to web 
services.  This has worked beautifully so far.  Now the team is 
introducing a new front end using JMS.  It is designed to work as a 
secondary front end to the existing web services.

For example, a customer can post a request directly to the web service 
via http GET or POST, or alternatively submit a message to the JMS 
service, which then will submit an http GET or POST to the web service. 
  The JMS service gives us the ability to prioritize and 
pre/post-process requests, which is why it is being introduced.

I built the tests so that we have a collection of story files & a single 
steps file.  The steps file includes the following:

public class StepsFile {
     MyService service;
     ServiceBuilder serviceBuilder;
     [a collection of @Given, @When, @Then methods]
}

The ServiceBuilder generates the service object at the appropriate time 
during testing.  'service' is then queried for results (within @Then steps).

Now that we need to handle two variations of MyService (http and JMS), 
can I configure JBehave to run thru the same stories twice, but 
injecting different versions of ServiceBuilder in to the StepsFile class 
for each iteration?  Is there a better way to handle this kind of 
implementation variation?

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

    http://xircles.codehaus.org/manage_email

Simon Kent | 4 Jan 14:24

Examples report formatting in 3.5.4

The HTML reporting format for example tables appears to have an issue in 
3.5.4

This is the output from one example in 3.5.4

      Example: {rule=sum(Money1) = 2501.1, output=true}

Given the data:
Side 	Sign 	Amount 	Currency 	Reference1 	Reference2 	ValueDate 
Money1 	Money2 	Integer1 	Boolean1 	DateTime1 	<br/> 	L 	D 	500 	GBP 
978825 	ALB INC 	01/01/2011 	500.0 GBP 	501.0 GBP 	1 	true 	10/11/2010 
15:23:00 	<br/> 	L 	D 	500 	GBP 	978825 	ALB INC 	03/01/2011 	501.1 
GBP 	502.1 GBP 	1 	true 	10/11/2010 15:23:00 	<br/> 	L 	C 	600 	GBP 
978824 	GHM 	01/01/2009 	700.0 GBP 	
	2 	false 	10/11/2010 15:23:00 	<br/> 	L 	C 	600 	GBP 	978824 	GHM 
01/01/2011 	300.0 GBP 	300.01 GBP 	2 	false 	10/11/2010 15:23:00 
<br/> 	L 	C 	700 	GBP 	REF978825 	ALB INC 	10/11/2010 	500 GBP 	499.76 
GBP 	3 	true 	10/11/2010 15:23:00 	<br/> 	L 	C 	800 	GBP 	978825REF 
IBM 	02/03/2010 	
	
	4 	true 	10/11/2010 15:23:00

And the rulesum(Money1) = 2501.1
When the rule is executed
Then the result should betrue

and the corresponding output from 3.4.3.....

      Example: {rule=sum(Money1) = 2501.1, output=true}

Given the data:
Side 	Sign 	Amount 	Currency 	Reference1 	Reference2 	ValueDate 
Money1 	Money2 	Integer1 	Boolean1 	DateTime1
L 	D 	500 	GBP 	978825 	ALB INC 	01/01/2011 	500.0 GBP 	501.0 GBP 	1 
true 	10/11/2010 15:23:00
L 	D 	500 	GBP 	978825 	ALB INC 	03/01/2011 	501.1 GBP 	502.1 GBP 	1 
true 	10/11/2010 15:23:00
L 	C 	600 	GBP 	978824 	GHM 	01/01/2009 	700.0 GBP 	
	2 	false 	10/11/2010 15:23:00
L 	C 	600 	GBP 	978824 	GHM 	01/01/2011 	300.0 GBP 	300.01 GBP 	2 
false 	10/11/2010 15:23:00
L 	C 	700 	GBP 	REF978825 	ALB INC 	10/11/2010 	500 GBP 	499.76 GBP 	3 
true 	10/11/2010 15:23:00
L 	C 	800 	GBP 	978825REF 	IBM 	02/03/2010 	
	
	4 	true 	10/11/2010 15:23:00

And the rulesum(Money1) = 2501.1
When the rule is executed
Then the result should betrue

Looks like the line breaks are formatted incorrectly? Or is there 
something to change to make it compatible with 3.5.4?

--

-- 
Simon Kent
QA Engineer
Gresham Computing PLC
e: skent <at> gresham-computing.com

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: Sopwith House, Brook Avenue, Warsash, Southampton. Hants. SO31 9ZA
Further information about Gresham Computing can be found on our website: www.gresham-computing.com 
Picon
Favicon

Reporting failures per example in parametrized tests while running with JUnit runner

Hi,

Using AnnotatedPathRunner/SpringAnnotatedPathRunner I was able to get JUnit test per story, which is
much more friendly than one big "run" test. I know I have nice looking JBehave report, but I wonder is it be
possible to get reporting per example in parametrized tests (something looking like in JUnitParams -
http://wiki.junitparams.googlecode.com/hg/images/test.png ) to receive instant report in IDE/CI
treating JBehave tests as JUnit tests?

Regards
Marcin

--

-- 
http://blog.solidsoft.info/ - Working code is not enough

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

    http://xircles.codehaus.org/manage_email


Gmane