Scenarios definition for JWT/API Process with Cucumber/Behat

Victor Mikó

I have a scenario where basically: - Authorized (JWT) user access my API - If user exists, info get synched with DB, if not, gets created - ETC ETC

My question is, how would I proceed creating this scenario? There's a lot (ok, 4) parameters that should be in the request, but I don't want to polute the scenario with information that can confuse a normal user reading the scenario.

This is what I have:

  Scenario: Non Existent user access the API
    Given an authorized user access the API
    And user does not exist on API database
    When user access the API
    Then user details are added to API database
    And user does exist on API database

A user accessing the api will have: email, auth0_id, nickname and name. Just not sure if I should code those info on the Scenario or somehow do it on the Context file.

Edit: Can I have some "parameters" to be set IN the Context file, instead of in the .feature file? i.e. On the feature file I say "Non existent user access the application" and inside the Context file, in the function associated with this step, I make sure I create a user that does not exist on the database and so on? Would this be a good way of keeping thinks separated from the .feature scenarios?

Thanks

lauda

I would write it like this:

Scenario: API - new user access the API
   Given I have a new user
   When I access the API with the new user
   Then the user is added to the API database

First step would generate the user details and save them in a variable, second would make the call to the api (using the saved variable and generate the JWT) and the last one will check the details in the api.

You can declare new as parameter like:

@Then /^I access the API with the (new|other_user) user$/

Anyway, you should declare it as simple as possible in a manner that has sense to you can that you can easily reuse.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Trying to process different scenarios in Service

From Dev

Editing a current process definition in Activiti

From Dev

How to import Activiti process definition as sub-process into master process?

From Dev

How to query finished instances of a process definition?

From Dev

How to query running instances of a process definition?

From Dev

Is there a way to get tasks in Activiti process definition without creating a process instance?

From Dev

jBPM 6 - deploy process definition from API to jbpm-console

From Dev

Is there a way to validate the build process parameters when editing the build definition in TFS?

From Dev

How to get the updated argument(s) of a build process template refreshed in 'Process' section of a build definition?

From Dev

Formulatext scenarios

From Dev

Error 'System.Diagnostics.Process' does not contain a definition for 'GetProcesses' in visual studio 2008 c#

From Dev

Getting error on deploying the process definition in activiti-rest using java code

From Dev

Phrasing Specflow scenarios

From Dev

Mac test scenarios

From Dev

in which scenarios onDestroy() is not called?

From Dev

Covering all scenarios with if statement

From Dev

Reuse scenarios by using mocha

From Dev

Concurrency scenarios with INSERTs

From Dev

Searching for scenarios in Sparx EA

From Dev

If statement for multiple scenarios

From Dev

Regenerate steps for scenarios in specflow

From Dev

The way to write protractor scenarios

From Dev

Java nested types scenarios

From Dev

SQL Order by with multiple scenarios

From Dev

Reuse scenarios by using mocha

From Dev

in which scenarios onDestroy() is not called?

From Dev

Regenerate steps for scenarios in specflow

From Dev

Concurrency scenarios with INSERTs

From Dev

The way to write protractor scenarios

Related Related

  1. 1

    Trying to process different scenarios in Service

  2. 2

    Editing a current process definition in Activiti

  3. 3

    How to import Activiti process definition as sub-process into master process?

  4. 4

    How to query finished instances of a process definition?

  5. 5

    How to query running instances of a process definition?

  6. 6

    Is there a way to get tasks in Activiti process definition without creating a process instance?

  7. 7

    jBPM 6 - deploy process definition from API to jbpm-console

  8. 8

    Is there a way to validate the build process parameters when editing the build definition in TFS?

  9. 9

    How to get the updated argument(s) of a build process template refreshed in 'Process' section of a build definition?

  10. 10

    Formulatext scenarios

  11. 11

    Error 'System.Diagnostics.Process' does not contain a definition for 'GetProcesses' in visual studio 2008 c#

  12. 12

    Getting error on deploying the process definition in activiti-rest using java code

  13. 13

    Phrasing Specflow scenarios

  14. 14

    Mac test scenarios

  15. 15

    in which scenarios onDestroy() is not called?

  16. 16

    Covering all scenarios with if statement

  17. 17

    Reuse scenarios by using mocha

  18. 18

    Concurrency scenarios with INSERTs

  19. 19

    Searching for scenarios in Sparx EA

  20. 20

    If statement for multiple scenarios

  21. 21

    Regenerate steps for scenarios in specflow

  22. 22

    The way to write protractor scenarios

  23. 23

    Java nested types scenarios

  24. 24

    SQL Order by with multiple scenarios

  25. 25

    Reuse scenarios by using mocha

  26. 26

    in which scenarios onDestroy() is not called?

  27. 27

    Regenerate steps for scenarios in specflow

  28. 28

    Concurrency scenarios with INSERTs

  29. 29

    The way to write protractor scenarios

HotTag

Archive