Skip to content

Instantly share code, notes, and snippets.

- name: Install latest Azure Functions V3 Runtime
run: npm install -g azure-functions-core-tools@3 --unsafe-perm true
- task: Npm@1
displayName: 'Install Latest Azure Functions V3 Runtime'
inputs:
command: custom
verbose: false
customCommand: 'install -g azure-functions-core-tools@3 --unsafe-perm true'
Scenario: Supplying an alternative greeting via configuration
Given I have set additional configuration for functions instances
| Key | Value |
| ResponseMessage | Welcome, {name} |
And I start a functions instance for the local project 'DemoFunction' on port 7075 with runtime 'netcoreapp3.0'
When I send a GET request to 'http://localhost:7075/?name=Jon'
Then I receive a 200 response code
And the response body contains the text 'Welcome, Jon'
[BeforeScenario("usingDemoFunctionPerScenario")]
public static Task StartFunctionsAsync(FeatureContext featureContext, ScenarioContext scenarioContext)
{
var functionsController = new FunctionsController();
scenarioContext.Set(functionsController);
return functionsController.StartFunctionsInstance(
featureContext,
scenarioContext,
"DemoFunction",
@usingDemoFunctionPerScenario
Scenario: A Get request including a name in the querystring is successful
When I send a GET request to 'http://localhost:7075/?name=Jon'
Then I receive a 200 response code
And the response body contains the text 'Hello, Jon'
Scenario: A Get request including a name in the querystring is successful
Given I start a functions instance for the local project 'DemoFunction' on port 7075 with runtime 'netcoreapp3.0'
When I send a GET request to 'http://localhost:7075/?name=Jon'
Then I receive a 200 response code
And the response body contains the text 'Hello, Jon'
@jongeorge1
jongeorge1 / specflow.json
Created February 28, 2020 14:52
Corvus.SpecFlow.Extensions reference in JSON config
{
"stepAssemblies": [
{ "assembly": "Corvus.SpecFlow.Extensions" }
]
}
@jongeorge1
jongeorge1 / specflow.config.xml
Created February 28, 2020 14:51
Corvus.SpecFlow.Extensions reference in XML config
<specFlow>
<stepAssemblies>
<stepAssembly assembly="Corvus" />
</stepAssemblies>
</specFlow>
[BeforeScenario("@useChildObjects", Order = 100)]
public static void SetupValueRetrievers(ScenarioContext scenarioContext)
{
var instance = new ChildObjectValueRetriever(scenarioContext);
scenarioContext.Set(instance, ChildObjectValueRetrieverKey);
Service.Instance.ValueRetrievers.Register(instance);
}
[AfterScenario("@useChildObjects", Order = 100)]
public static void TearDownValueRetrievers(ScenarioContext scenarioContext)
@jongeorge1
jongeorge1 / Demonstration.feature
Created February 28, 2020 14:26
Demonstration of SpecFlow scenario using child objects
@useChildObjects
Scenario: Demonstrating how this approach looks
Given I have a User called 'Jon'
And I have a User called 'Matthew'
And I have the following expense claims
| Date | Amount | User | Description |
| 26/02/2020 | £25 | {Jon} | Travel to Endjin team away day |
| 26/02/2020 | £40 | {Matthew} | Travel to Endjin team away day |