1

I have a specflow API service testing scenario that look somewhat like below. Weekend = saturday and sunday . We are using Nunit Framework

Scenario Outline: Weekend test scenario for calculator scervice 
Given today is weekend
And calculator with amounts <value1> , <value2>  and <operator> 
When calculator service is called
Then amount and operator field is editable
Examples: 
| value1 | value2 | operator|   
| 200    | 300    | plus    |   

I want this test to get ignored on run time - if I am running this test in weekday. How do I achieve this ?

Priyanka Ray
  • 85
  • 2
  • 9
  • To clarify the question: what do you mean with ignoring on runtime? When do you want to make the desicion to ignore it? When you write the scenario or when you execute the scenarios? – Andreas Willich Jun 22 '18 at 08:19
  • When I execute the scenario - the question has been answered :) by several people below and my problem got resolved by adding a tag and then writing a before scenario step for that tag :) @Andreas Willich – Priyanka Ray Jun 25 '18 at 13:20
  • Ok, then I misunderstood your question. I wantet to be sure before I delete my answer. – Andreas Willich Jun 25 '18 at 14:04

2 Answers2

0

If I correctly understood your question, I think, that you can use tags in your feature files. NUnit will see these tags as Categories. When need to run tests, then you can choose, what you want to run.

Ukrainis
  • 534
  • 2
  • 16
0

By adding @Ignore tag to the scenario / feature to be ignored. It will be generated automatically to the corresponding attribute under the hood in the generated files

But, it will not help you. You need to rewrite your test so it will be passed whenever it runs. Try to use stubs and mocks to mock the current day

Liraz Shay
  • 86
  • 4