简体   繁体   中英

Specflow : How do I create a single shared step to rule all Logins to a system with multiple user roles?

Okay, so I have read every piece of documentation relating to Specflow, I have searched high and low for a definitive answer on whether or not this is possible, and toyed around with it myself to no avail.

Here is the "mission background" for my step: 1. Our System has 20 User Roles that each have different permissions and functions within our Web Application. They log in via a 9 digit PIN on the home page.

  1. I want to be able to pass a user PIN as a parameter and have that pin be able to change depending on the scenario Just to be clear, I need the scenario to NOT execute with EVERY user pin variation. That is what I am struggling with

  2. The PIN is the only thing that changes between the step variations

I am not really sure how to do this in a shared step with a parameter without making an additional step

  1. I want one login step to rule them all

Now, the things I have tried or have explored but tabled because I am not sure they will work or have serious questions about HOW they work:

  1. Putting all the values in a table in the feature file - Not sure this will work because the test would go down through all the values? (Not entirely sure this is accurate, but it is what I can glean from nonspecific documentation) I am also not entirely sure how I would change the PINs if a scenario calls for another user type.

  2. Putting quotes around the PIN Values in the feature file - I am entirely not sure how this works in practice because I could not find any code examples in my searches and the documentation only has like...2 short sentences about this. If someone could explain this to me that would be wonderful for my own edification

So I can't really see a clear way forward with this plan of mine and I really don't want to make 20+ near identical steps. Can anyone give me an idea of how this can be accomplished in Specflow or is it just wishful thinking?

I am not asking for anyone to code this for me. I just need some direction on where to go or some explanation on a solution if this kind of step is indeed possible.

Edit: Here are two example scenarios that would benefit from a shared login step

Scenario: LOD - Next Action Tab - HRC Reviewer - AR Death (Formal) - HRC Admin LOD Review Status
    Given I am logged in as HRC Reviewer using PIN "111111111"
    And I have navigated to MY LOD tab in eMMPS
    When  I click on the Case ID Link of an AR Death LOD in HRC LOD Appeal Review Status
    And I click the Next Action Tab
    And I click the drop down menu of Action Field in the Signature Section
    Then the options for AR Formal LOD are displayed

Scenario: LOD - Next Action Tab - Unit Admin - AR Formal LOD - Appeal Review
    Given I am logged in as Unit Admin using PIN "000000000"
    And I have navigated to MY LOD tab in eMMPS
    When  I click on the Case ID Link of an AR Formal LOD in HRC LOD Appeal Review Status
    And I click the Next Action Tab
    And I click the drop down menu of Action Field in the Signature Section
    Then the options for AR Formal LOD are displayed

if I properly understand you need something like this: How do I use SpecFlow's "Scenarios" keyword?

or if not could you please write a couple of scenario as an example

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM