Note that there are some explanatory texts on larger screens.

plurals
  1. POJbehave - @beforeStories doesn't work
    primarykey
    data
    text
    <p>My story file:</p> <pre><code>Narrative: In order to document all the business logic requests As a user I want to work with documents Scenario: Basic new document creation Given a user name Micky Mouse When new document created Then the document should named new document And the document status should be NEW </code></pre> <p>My code:</p> <pre><code>public class DocStories extends JUnitStory { @Override public Configuration configuration() { return new MostUsefulConfiguration().useStoryLoader( new LoadFromClasspath(getClass().getClassLoader())) .useStoryReporterBuilder( new StoryReporterBuilder().withFormats(Format.STATS, Format.HTML, Format.CONSOLE, Format.TXT)); } @Override public List&lt;CandidateSteps&gt; candidateSteps() { return new InstanceStepsFactory(configuration(), new DocSteps()) .createCandidateSteps(); } @Override @Test public void run() throws Throwable { try { super.run(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } </code></pre> <p>In the class with my steps:</p> <pre><code>public class DocSteps { private final Map&lt;String, User&gt; users = new HashMap&lt;String, User&gt;(); private final DocManager manager = new DocManager(); private User activeUser; private Document activeDocument; private boolean approvedResult; *****************BEFORE***************// @BeforeStories private void initUsers() { users.put("Micky Mouse", new User("Micky Mouse", UserRole.ANALYST)); users.put("Donald Duck", new User("Donald Duck", UserRole.BCR_LEADER)); System.out.println("Check this out" + users.toString()); } // **********steps*************// @Given("a user name $userName") public void connectUser(String userName) { // in the real world - it will get the user from the db System.out.println(userName); activeUser = new User(userName, UserRole.ANALYST); // System.out.println(activeDocument.getName()); } @Given("a new document") @When("new document created") public void createDocument() { activeDocument = new Document(); } @Given("a document with content") public void createDocWithContect() { createDocument(); activeDocument.setContent("this is a document"); } @Then("the document should named $docName") @Alias("the document name should be $docName") public void documentNameShouldBe(String docName) { Assert.assertEquals(docName, activeDocument.getName()); } @Then("the document status should be $status") public void documentStatusShouldBe(String status) { DocStatus docStatus = DocStatus.valueOf(status); Assert.assertThat(activeDocument.getStatus(), Matchers.equalTo(docStatus)); } // *****************AFTER***************// @AfterScenario public void clean() { activeUser = null; activeDocument = null; approvedResult = false; } } </code></pre> <p>The methods with the "before and after" stories annotation are not executed. the <code>enum</code> converter doesn't work as well.</p> <p>What is wrong with my configuration (I assume it is my configuration)?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload