Advance Payment Guarantee – Advance Payments – Advance Payment Bond
Jbehave- Basics to Advance
-
Upload
ravinder-singh -
Category
Software
-
view
180 -
download
1
Transcript of Jbehave- Basics to Advance
QA Myths
You only need to unit test. TDD testing is sufficient.
You can reuse unit tests to build a regression test suite.
We no longer need testers, as Developer have adequate coding skills.
Unit test remove the need of manual testing.
User Acceptance testing is no longer needed.
Automation in so early phases is impossible.
TDD/BDD is applicable on every project.
Developers and testers are like water and oil.
Unit Testing Frameworks in Java
JUnit
Cactus
StrutsTestCase
TestNG
jMock
Grinder
Jetif
Unitils
p-unit
XMLUnit
Ejb3Unit
FEST-Swing
Ripplet
Feed4JUnit
...
JUnit
@Test Annotation
JUnitCore
Exception Test
@Ignore
Timeout Test
TestSuite
Before and After Annotations
@BeforeClass and @AfterClass
Parameterized Test
TestNG
Annotations
Exception Test
Ignore Test
Timing Test
TestSuite
Parameterized Test
Test Dependency
Group Test and Dependency
1. Write Story
Create New Maven project using MyNumber class used in previous examples.
Add Jbehave plugin in IntelliJ
Add dependencies of Jbehave and Junit
Add a new story under test resources folder
3. Configure Stories
Implement a TestRunner class by extending class JUnitStory.
Override the configuration and stepsFactory methods.
Ensure that story name would be same as test name with _ updated for each Camel Case.
This is because of the configuration used for loading of story, i.e., MostUsefulConfiguration
JUnit-enabled Embeddables
JUnitStory: provides a one-to-one mapping with the textual story.
JUnitStories: provides a many-to-one mapping with the textual story paths
Story Syntax
JBehave Syntax
Narrative:
Lifecycle:
Before:
After
Scenario
Gherkin Syntax
Narrative:
Background:
Given:
Scenario/Scenario Outline:
Gherkin's Background element corresponds to the JBehave Lifecycle Beforeelement.
JBehave also supports a Lifecycle After element which is not currently available in Gherkin.
Annotations
Step Annotations.
@Given
@When
@Then
@Alias
@Aliases
@Pending
Scenario Annotations.
@BeforeScenario
@AfterScenario
Story Annotations.
@BeforeStory
@AfterStory
Stories Annotations.
@BeforeStories
@AfterStories
Parameter Annotations.
@Named
Step Annotations
@Given
@When
@Then
@Alias
@Aliases
@Pending
Dry Run Mode
Check if any steps are pending but without actually executing any of the steps
Scenario Annotations
@BeforeScenario
@AfterScenario
Story Annotations
@BeforeStory
@AfterStory
Stories Annotations
@BeforeStories
@AfterStories
Parameter Annotations
@Named
Prioritizing Steps
For cases in which multiple candidates can match the same textual step, the first candidate that matches is used to create an executable step.
To prioritize one candidate over another simply set a non-zero positive priority.
Story Path’s
Class-path – Arrange in any folder hierarchy within project.
URL-Loader (Running Remote Stories) – Specify the path from a URL
Google-docs (Running Remote Stories) – No more supported, due to change in google authorization, but can be customized, if needed for a project.
Reporting
ConsoleOutput
IdeOnlyConsoleOutput
TxtOutput
HtmlOutput
HtmlTemplateOutput
XmlOutput
Customizing Reports
Specify the FTL File
Define a custom Template that will use the FTL file
Use this reporter in TestRunner
UI Testing
Use Serenity Stories
Specify properties in serenity.properties or from maven command line options
Specify “aggregate” goal to aggregate reports.
CI Setup - Jenkins
Download Jekins from https://jenkins.io/download/
Install Jenkins.