Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97756

Pass POJOs in Cucumber Example table

$
0
0

Description: As a test developer, I would like to use a single scenario to test 3 different environments.

Simplified Scenario example:

  @smoke
  Scenario: Login to the login page and assert that the user is logged in
    Given User navigates to the page
    And User enters valid login credentials
    When User clicks on the login button
    Then Landing page can be seen

Data ( These are grabbed from a property file - converted to POJO ) :

Env1.class
url = www.environment1.com
username = john
password = doe1

Env2.class
url = www.environment2.com
username = john2
password = doe2

Env2.class
url = www.environment3.com
username = john3
password = doe3

Test Setup

  1. Each environment has its own test runner ( failsafe )
  2. Each environment runs in parallel.
  3. Test runs and is built via ~mvn clean verify
  4. Tests are property file dependant as environments may change.

Potential solution: Is there a way to pass POJOs in the Example Table? or Cucumber's data table?

I am new to BDD and Cucumber - any help would be great. Thank you.

TLDR: is there a way to pass the Prop File variable in the Examples Table in Cucumber?

| URL | Username | Password | 
| env1.getUrl | env1.getUsername | env1.getPassword |

So it'll be

 @smoke
  Scenario: Login to the login page and assert that the user is logged in
    Given User navigates to the page <URL>
    And User enters valid login credentials <Username> and <Password>
    When User clicks on the login button
    Then Landing page can be seen

Viewing all articles
Browse latest Browse all 97756

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>