You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

In this tutorial, we will create some tests in Cucumber/Gherkin, using SpecFlow and C#.


Please note

There are some possible workflows related with Cucumber. More info in Testing with Cucumber.

In this tutorial, we assume that the te

The test (specification) is initially created in Jira as a Cucumber Test and afterwards, it is exported using the UI or the REST API.



Requirements

  • Install SpecFlow and the SpecFlow+ Runner 1.7.2 or newer

Description


After creating Cucumber Tests of type "Scenario" or "Scenario Outline", in Jira, you can export the specification of the test to a Cucumber .feature file via the REST API or the Export to Cucumber UI action from within the Test Execution issue.

The created file will be similar to the following: 


1_CALC-889.feature
@CALC-2250
@REQ_CALC-2247
Feature: Sum Operation
	#In order to avoid silly mistake
	#
	#As a math idiot
	#
	#I want to be told the sum of two numbers

	
	@TEST_CALC-2249
	Scenario Outline: Add two positive numbers
			Given I have entered <input_1> into the calculator
			And I have also entered <input_2> into the calculator
			When I press <button>
			Then the result should be <output> on the screen
			
			  Examples:
			    | input_1 | input_2 | button | output |
			    | 20      | 30      | add    | 50     |
			    | 2       | 5       | add    | 7      |
			    | 0       | 40      | add    | 40     | 
			    | 4       | 50      | add    | 54     | 
			    | 5       | 50      | add    | 55     | 	

	
	@TEST_CALC-2248
	Scenario: add two numbers
			Given I have entered 50 into the calculator
			And I have also entered 70 into the calculator
			When I press add
			Then the result should be 120 on the screen	

	
	@TEST_CALC-2251
	Scenario Outline: add two negative numbers
		Given I have entered <input_1> into the calculator
		And I have also entered <input_2> into the calculator
		When I press <button>
		Then the result should be <output> on the screen
					
			Examples:
			| input_1 | input_2 | button | output |
			| -1      | -2      | add    | -3     |
			| 1       | -1      | add    | 0      |



After running the tests and generating the Cucumber JSON  report (e.g., data.json), it can be imported to Xray via the REST API or the Import Execution Results action within the Test Execution.

ss


The execution screen details will not only provide information on the test run result, but also of each of the examples provided in the Scenario Outline.


 


The icon represents the evidences ("embeddings") for each Hook, Background and Steps, but is only available for executions done in Xray v2.3.0 and above.

Learn more

Please see Testing with Cucumber for an overview on how to use Cucumber Tests with Xray.


References


  • No labels