Hi,
as detailed in http://jbehave.org/reference/stable/faq.html, you need to
ensure that the source of JBehave is available to Eclipse. If you're
using Maven integration (via m2e plugin) ensure that you are downloading
the sources.
Else, add the source jar manually or use the workaround proposed adding
to your PcInstallerLinkTest the method:
|||@Test|
|||public| |void| |run() ||throws| |Throwable {|
|||super||.run();|
|||}|
Cheers
On 09/06/2013 11:20, Kristjan Laane wrote:
Hi again!
I cannot get my first JUnitStory to be visible in the JUnit window of
Eclipse (Juno Java EE), the list is just empty in the Eclipse JUnit
window (unlike here for instance
http://twasink.files.wordpress.com/2012/06/jbehave_simple.png )
The test class (based on
http://jbehave.org/reference/stable/getting-started.html ):
-----------------------------------
public class PcInstallerLinkTest extends JUnitStory {
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(this.getClass()))
.useStoryReporterBuilder(
new StoryReporterBuilder().withDefaultFormats()
.withFormats(Format.CONSOLE, Format.TXT));
}
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new
PcInstallerLink());
}
}
-----------------------------------
Here are the steps:
-----------------------------------
public class PcInstallerLink {
@When("$webPage is open in a modern web browser")
public void webPageOpen(@Named("webPage") String webPage) {
}
@Then("a hyperlink is present linking to $linkFileName")
public void linkPresent(@Named("linkFileName") String linkFileName) {
}
}
And here is the story:
-----------------------------------
!-- Highest priority as without providing at least the PC component,
the solution cannot be used at all
Narrative:
In order to have the ProductName solution available to set up
As a user and a business
I want to publish installers
Scenario: PC Installer Link
!-- GivenStories:HomePage.story
When 'product.company.com <http://product.company.com>' is open in a
modern web browser
!-- Edge cases:
!-- "any browser at all"?
!-- Is there a requirement that the page be accessible to text-only
browsers?
!-- Text-to-speech? (and all the other interesting things that come with
!-- accessibility testing for disabled users) Touch screen? Mobile users?
Then a hyperlink is present linking to 'ProductSetup.exe'
-----------------------------------
A couple of potential leads why I cannot run my JUnitStory in Eclipse:
* It was not clear to me what jars are needed exactly for plain
JBehave with JUnit, so i have referenced only jbehave-core.jar
downloaded from
http://jbehave.org/reference/downloads/web/bin/stable - do i need
any other jar references in the massive jbehave web lib folder?
* The steps (PcInstallerLink.java) and test class
(PcInstallerLinkTest.java) are in the directory
/src/tests/scenarios/ but the .story file is in the directory
/features/ which is not marked as a source folder from the point
of view of Eclipse project properties (under Java Build Path ->
Source tab) - is having completely different directories for the
stories and java classes the root issue?
* I also have a number of other .story files and all of these other
stories have steps missing at the moment i.e. i have a number of
"No step is matching... " warnings. Could this be the problem?
(note that the project builds fine, there are no errors)
Would love any advice on how i could start testing / development. Thanks!
p.s. Mauro, I created a new ticket for the GivenScenario feature in
JIRA: http://jira.codehaus.org/browse/JBEHAVE-923