Intents

step defs abstraction for cucumber jvm implementation

License

License

Categories

Categories

Ant Build Tools Vagrant Container Virtualization Tools
GroupId

GroupId

com.testvagrant.intents
ArtifactId

ArtifactId

intents
Last Version

Last Version

2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Intents
step defs abstraction for cucumber jvm implementation
Project URL

Project URL

https://github.com/testvagrant/intents
Source Code Management

Source Code Management

https://github.com/testvagrant/intents

Download intents

How to add to project

<!-- https://jarcasting.com/artifacts/com.testvagrant.intents/intents/ -->
<dependency>
    <groupId>com.testvagrant.intents</groupId>
    <artifactId>intents</artifactId>
    <version>2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.testvagrant.intents/intents/
implementation 'com.testvagrant.intents:intents:2.0'
// https://jarcasting.com/artifacts/com.testvagrant.intents/intents/
implementation ("com.testvagrant.intents:intents:2.0")
'com.testvagrant.intents:intents:jar:2.0'
<dependency org="com.testvagrant.intents" name="intents" rev="2.0">
  <artifact name="intents" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.testvagrant.intents', module='intents', version='2.0')
)
libraryDependencies += "com.testvagrant.intents" % "intents" % "2.0"
[com.testvagrant.intents/intents "2.0"]

Dependencies

compile (4)

Group / Artifact Type Version
com.google.guava : guava jar 22.0
org.reflections : reflections jar 0.9.11
com.google.code.gson : gson jar 2.8.1
com.testvagrant.optimus-commons : optimus-commons jar 3.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-core jar 2.8.47

Project Modules

There are no modules declared in this project.

INTENT

An Intent is a small reusable action, similar to a scenario. However, it has no purpose, if it isn't used in a context.

NOTE: Intents feature is not compatiable with Java8 step definitions

Eg:

      @Intent
      Scenario: Login
      Given User enters username as JohnNash
      And User enters password as NashJohn
      When User clicks on submit
      Then User is navigated to HomeScreen

Usage:

     Scenario: Book a cab
     Given  Intent: Login
     When  I enter to and from locations
     And   I click on BookACab
     Then  I should receive a booking confirmation

Sometimes it is needed to override default values as in the above example user would like to login other than 'JohnNash'. It is possible to modify the default values of Intent as below. Usage:

     Scenario: Book a cab
     Given   DataIntent: Login
     |Admin|pass@123|
     When I enter to and from locations
     And  I click on BookACab
     Then I should receive a booking confirmation

Using intent in code:

     String intentId = "Login";
     intentRunner(intentId).run();

If the default data is overridden, pass the datatable object to intent runner.

     String intentId = "Login";
     intentRunner(intentId).useDatatable(datatable).run();

If the step definitions are created in a package apart form the standard com.testvagrant.intents.steps package, you can let Intent know about it as below.

     String intentId = "Login";
     String stepDefinitionsPackage = "com.example.exampleStepsPackage";
     intentRunner(intentId)
     .useDatatable(datatable)
     .locateStepDefinitionsAt(stepDefinitionsPackage)
     .run();

Suggested Usage :

  • Intents are like the helper methods, though they look like Scenarios, it is adviced that they aren't executed as a scenario.

  • Choose any convenient tagname for Intents and ignore them while running Cucumber Features using ~.

    Eg: In cucumber command line options pass

      --tags, "~@Intent"
    
  • Create a common step definition matching your Intent and DataIntent.

    Eg: For an Intent, the step definition can be

      @Given("^(Intent):(.*)$")
      public void intent(String action, String intentId) throws Throwable {
          intentRunner(intentId).run();
      }
    

    Eg: For a DataIntent, the step definition can be

      @Given("^(DataIntent):(.*)$")
      public void intentWithDataTable(String action, String intentId, DataTable dataTables) throws Throwable {
          intentRunner(intentId).useDatatable(dataTables).run();
      }
    
com.testvagrant.intents

TestVagrant Technologies

Versions

Version
2.0
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0