Hi,
glad you got it working, but I'm sure I follow the process you describe.
As pointed out in the FAQ, the easiest option is to use the m2e plugin.
The plugin can download the sources jar automatically (configured in the
Preferences > Maven ).
You shouldn't need to do what you describe.
Cheers
On 14/06/2013 00:06, Kristjan Laane wrote:
Thanks! Got it to work based on your advice. Had to do a number of
other things as well as prerequisites, appended for reference in case
anyone else is having similar troubles (there are many other ways of
doing it too):
BTW don’t get fooled like me – insetad of getting the core package you
want to get the Web package because the latter has all the .jar
dependencies bundled unlike the first one.
http://ivanz.com/2011/05/25/java-bdd-with-jbehave-and-watij-in-eclipse-with-junit/
*but manually adding just the core jar from web lib folder does not
work when it comes to actually running tests, because it has loads of
dependencies that are not satisified – instead follow the following
procedure:*
git clone latest sources https://github.com/jbehave/jbehave-core (of
this repo https://github.com/jbehave/jbehave-core ), clone into the
folder jbehave-core, which is itself under jbehave non-cloned folder
where the eclipse workspace will go so that the pom.xml in root could
be imported to eclipse as well (the jbehave-core pom depends on the
root pom, so need that)
Source Repository
http://jbehave.org/reference/stable/source-repository.html
install maven plugin m2e for eclipse
(http://eclipse.org/m2e/download/), from the update site
http://download.eclipse.org/technology/m2e/releases
create new eclipse workspace under the non-cloned root root folder jbehave
import new maven projects from existing sources, by pointing to the
root jbehave-core – this may take awhile
check that jbehave-core project has no errors (others may do)
create a new folder under your actual project called jbehave, commit
it and ignore it
create a junction to jbehave-core (the non-root one under jbehave-core
root), and symbolic links to the root root pom.xml and other files:
Import maven project from existing sources to the actual project
workspace in eclipse (as a separate project to the actual project)
Check that that one has no errors / it has all the Maven Dependencies
showing nicely:
*And then add the maven project as a dependency to the actual project,
BUT HAVE TO USE Java Build Path -> Projects -> Add.. and NOT Project
References!:*
And add the @Test annotation to see
On 9 June 2013 14:52, Mauro Talevi <[email protected]
<mailto:[email protected]>> wrote:
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