How to apply condition IF...ELSE in MAF CUCUMBER

53 Views Asked by At

Currently, I have 2 cases in the following detail

I run an API with a file upload, after API is run successfully. There are 2 statuses it can be displayed

  1. status = waiting
  2. status = ready_to_process (this is the correct status if the system not have a problem)

NOTE: The status change like that is cause be system sometime can't change at the time file is uploaded, but it can be recorded to DB and run successfully

And then in the Database, data change is also different

  1. Changed to the role: unknow
  2. Changed to the role: pass

How can I write steps if..else in Cucumber use MAF framework like: If API run then it returns status 1 => verify the result 1 in DB Else verify result 2 in DB

1

There are 1 best solutions below

0
On

You can't write conditional code in Cucumber features. What you should be doing is writing a scenario for each condition. So you should write something like


Scenario: Run ends with waiting status
  ...
Scenario: Run ends with ready to process status
  ...