SlideShare a Scribd company logo
FLAVOURS
BDD Flavours (Cucumber/Gherkin)/Karate
D. Harrison
March 2021
© 2021, David Harrison, All Rights Reserved
Table of
CONTENTS
Introduction.............................................................................1
The Classic Form ......................................................................2
The Technical Form ..................................................................5
Test Runner.............................................................................8
Test Execution .........................................................................9
Remarks ............................................................................... 11
INTRODUCTION
Behaviour Driven Development [here], which in the case of test automation
might be better termed Behaviour Driven Test Automation (BDTA), relies on the
use of a spoken language-style set of statements as the starting point in the
development of tests for an application.
However, in today’s landscape of test automation there appears to be two
flavours of BTDA; one that can usefully be termed the Classic, and one that
might be termed Technical.
The fundamental technology in both cases is the use of the Gherkin [here]
language to describe a unit of testing, a Scenario, which in the case of the
classic form, via a Step Definition file, enact the appropriate actions and
validations. In the technical form no such code-behind is required.
In the Java world this Gherkin language form is hosted in an environment called
Cucumber [here]. Alternatively, in the C# world this Gherkin syntax is hosted in
an environment called SpecFlow [here].
The technical form of BDD is exemplified by the tests written using the Karate
framework [here]. This framework can be used in both Java (IntelliJ) [here] and
C# (VSCode) [here] development environments.
Let us look at these two BDD forms, in the context of crud operations in a
target application and identify and compare their key characteristics.
2
The Classic Form
The classic form of BDD might usefully be characterised by the following
example:
In this example, the Scenario Outline test validates workflow of an application
related to “creating” a “business object” in the persistent store. The Examples
table specifies that the object is in fact a “Customer”. Of course, for a full CRUD
feature set we would need to write tests for “updating” and “deleting” and
ensure that all such Scenarios are synchronised on the same business object.
As can be seen, the test describes the UI-based user journey required to
achieve the desired outcome, creating a Customer business object.
Behind the scenes these statements link, via the default Cucumber text
matching approach, to Step Definition statements, for example, as illustrated in
the fragment below:
3
The solution shown here reflects the pattern described in the earlier article “UI
Testing Pattern” [here].
The testing focusses on the user workflow to assert that a “business-object” has
been successfully added to the persistent store of the application. The assertion
necessarily needs to be made in the “@After” method associated with the
4
executing Cucumber test and uses a utility class to query the back-end
database for a specific entry, the details of which are held in the
testContextJava object.
Further Scenarios will necessarily need to be written to cover the workflows
associated with the update and delete aspects of “CRUD”. These additional
Scenarios would need to be synchronised to focus on the appropriate common
data. As normal in testing we should aim to delete what we add to a system
when we test.
In the target application the front end is connected to the back end via RESTful
services, so, given this, we could assert the correctness of this business
operation in a more fundamental way than that offered by exercising the front-
end – enter Karate and API testing.
5
The Technical Form
The technical form of BDD is characterised by tests written using the Karate
framework [here]. The focus of Karate is to permit fast and consistent testing of
APIs and has the bonus that it does not require code-behind Step Definitions to
be written. It should be noted that this framework cannot co-exist with the
classic form in a project.
We will be using the backend RESTful API of the application that was used
above and that was introduced in “UI Testing Pattern” [here], as the basis of
our tests. Specifically, we will look at the CRUD operation for the Customer
business object.
An example Karate test is as shown below, testing the CRUD operations
associated with “customers”:
6
7
Here we see a Feature, “Customers-related CRUD process”, together with a
Background section and single Scenario Outline “Customers CRUD operations”, in
which the (create/update/delete) operations offered by a RESTful API are being
exercised. This API is one of those offered by the backend of the application
introduced in the article “UI Testing Pattern” [here]. In this API it is necessary
to firstly get an identity token which will be used in the header of subsequent
calls, and this is what is happening in the initial block (lines 14-24). Once this
is obtained, it is used as a “bearer” token in the header of the “create” call
configured and initiated in the following block (lines 27-53).
We then see a block that performs the “update” action (lines 54-66) followed
by one that performs the “delete” (lines 68-86).
In lines 27-30 it should be noted how we make use of Karate’s Java interop
mechanism to construct random data for our Customers object. The class,
JavaUtils, is in the Karate project and provides a range of static helper
methods.
In line 50, 80 and 85 we use another supporting Java type, JavaDbUtils, which
provides database-related methods, to enable assertions to be made related to
record counting as well as table entry deletion. It should be noted that the
application currently only marks “deleted” table entries with a non-null
8
deletedAt field value corresponding to the (GMT) delete-time. To actually clean
up after our test we need to perform a SQL delete operation with an
appropriate where clause.
In this test we see keywords like “Given”, “And”, “When” and “Then”, echoing the
classic BDD form, but now they act as prefixes to more technically focused
statements. No code-behind is needed in order to have a functioning test case.
We can also see how the “* def”, definitional statement is quite prevalent,
setting up the various data elements used in requests and so on.
In our case, using the business object Customers, the API does not provide data
in the responses, hence we do not need to use the powerful matcher
capabilities of the framework to assert the correctness of response fields.
However, we do need to assert that the “create” and “delete” work as expected,
we do not want to just rely on getting an API success status. In these cases, as
noted earlier, we use, special Java types to directly query the backend database
and ensure that these operations are indeed successful.
Test Runner
To run our tests, we need a simple runner class, this is shown below:
Right clicking on the green glyph at line 8 and choosing “Run
testCustomers_CRUD()” or “Debug testCustomers_CRUD()” causes our test to run
(in the appropriate execution mode). The run command, instead of simply
referencing a feature file name, can have a chained set of tags referencing
specific Scenario or Scenario Outline tests that you want to have executed.
9
Test Execution
The tests as shown here where developed and run within the IntelliJ IDE. In the
console, the most basic form of test output, we see:
20:36:22.390 [main] INFO com.intuit.karate - [print] Token URL: http://localhost:8080/api/auth/sign-in
20:36:23.734 [main] INFO com.intuit.karate - [print] Token rqst response:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImIyNGI4YTQwLWE1MmItNDIxNi05MmZmLWZhYjYwMmNhNTZjMiIsImlhdCI6MTYxO
TExNjU4MywiZXhwIjoxNjE5NzIxMzgzfQ.UpAmVLfCV4zkZkX42ttr4rkvZofHSVrDX4EpPhvacos
20:36:23.777 [main] INFO com.intuit.karate - [print] Customer Number : 1258
20:36:23.780 [main] INFO com.intuit.karate - [print] Customer Telephone Number: 0048596849309
20:36:23.782 [main] INFO com.intuit.karate - [print] Customer Zip Code : 4331
20:36:23.786 [main] INFO com.intuit.karate - [print] Customer Name : Harrison Models635 AG
20:36:24.038 [main] INFO com.intuit.karate - [print] After CREATE, WHERE clause: customerName='Harrison
Models635 AG' AND deletedAt IS NULL
20:36:25.117 [main] INFO com.intuit.karate - [print] POST response: {
"country": "Switzerland",
"city": "Elgg",
"contactFirstName": "David",
"postalCode": "4331",
"salesRepEmployeeNumber": {
"officeCodeId": null,
"lastName": "Jones",
"extension": null,
"jobTitle": null,
"reportsToId": null,
"updatedById": "b24b8a40-a52b-4216-92ff-fab602ca56c2",
"employeeNumber": 1504,
"firstName": "Barry",
"createdAt": "2021-04-21T13:45:19.000Z",
"deletedAt": null,
"importHash": null,
"tenantId": "7c4ac4a7-c1ad-4e02-b3ff-974693ae8719",
"id": "b242b72e-115e-44bc-981b-870cb404118a",
"email": null,
"createdById": "b24b8a40-a52b-4216-92ff-fab602ca56c2",
"updatedAt": "2021-04-21T13:45:19.000Z"
},
"customerNumber": 1258,
"updatedById": "b24b8a40-a52b-4216-92ff-fab602ca56c2",
"customerName": "Harrison Models635 AG",
"createdAt": "2021-04-22T18:36:23.000Z",
"deletedAt": null,
"importHash": null,
"phone": "0048596849309",
"salesRepEmployeeNumberId": "b242b72e-115e-44bc-981b-870cb404118a",
"tenantId": "7c4ac4a7-c1ad-4e02-b3ff-974693ae8719",
"addressLine1": "Stutzstrasse 10a",
"creditLimit": "3500.00",
"addressLine2": null,
"id": "5ad1e62f-5676-4258-805a-6dd0b8fdcf28",
"state": "Zurich",
"createdById": "b24b8a40-a52b-4216-92ff-fab602ca56c2",
"updatedAt": "2021-04-22T18:36:23.000Z"
}
20:36:25.547 [main] INFO com.intuit.karate - [print] After DELETE(1), WHERE clause: customerName='Harrison
Models635 AG(2)' AND deletedAt IS NOT NULL
20:36:25.623 [main] INFO com.intuit.karate - [print] After DELETE(2), WHERE clause: customerName='Harrison
Models635 AG(2)'
---------------------------------------------------------
feature: classpath:karate/Customers/Customers_CRUD.feature
scenarios: 1 | passed: 1 | failed: 0 | time: 3.2691
However, as with the classic BDD form, Karate produces an HTML report which
is referenced in the console and this looks much more visual:
10
Of course, in our case we only see one entry. In a production environment the
volume of results would be very much greater.
11
Remarks
We have shown how the two forms of BDD style, classic and technical, can be
used for automated testing. The two forms apply in quite distinct areas of
testing, one, the classic, is particularly good at expressing business-level
workflow, user-journeys. The technical form, on the other hand, is particularly
good at the testing of APIs, whether SOAP or RESTful. It can also be used for
testing GraphQL [here] interfaces. Its use of the Cucumber/Gherkin keywords is
rather a case of syntactic sugar and should not be taken to indicate any wider
conformity with the classic approach.
We have shown how identity tokens, required as part of the header in each API
call, can be handled as well as how Java types can be factored into a test case,
thus providing more complex operations than offered by the framework. As well
as RESTful, SOAP APIs and GraphQL, Karate has been extended to provide
testing support for gRPC interfaces [here]. This topic will be specifically covered
in a later article.
The two approaches complement each other perfectly – a great pair of tools for
any test automation toolbox.

More Related Content

What's hot

Java 14 support in Eclipse IDE
Java 14 support in Eclipse IDEJava 14 support in Eclipse IDE
Java 14 support in Eclipse IDE
Noopur Gupta
 
Tutorial%20fivestar%20cck%20views
Tutorial%20fivestar%20cck%20viewsTutorial%20fivestar%20cck%20views
Tutorial%20fivestar%20cck%20views
tutorialsruby
 
Oracle Apps INVENTORY
Oracle Apps INVENTORY Oracle Apps INVENTORY
Oracle Apps INVENTORY
Manu MK
 
Type Adoption in xCP 2.1 Applications
Type Adoption in xCP 2.1 ApplicationsType Adoption in xCP 2.1 Applications
Type Adoption in xCP 2.1 Applications
Haytham Ghandour
 
People soft workflow by surya 2
People soft workflow by surya 2People soft workflow by surya 2
People soft workflow by surya 2
meghamystic
 
Creating Workflows Windows Share Point Services
Creating Workflows Windows Share Point ServicesCreating Workflows Windows Share Point Services
Creating Workflows Windows Share Point Services
LiquidHub
 
Test script
Test scriptTest script
Test script
Bharathi P
 
Workflow functional concept on openerp7
Workflow functional concept on openerp7Workflow functional concept on openerp7
Workflow functional concept on openerp7
Aziza Mohamed
 
Sap ps module tutorial
Sap ps module tutorialSap ps module tutorial
Sap ps module tutorial
achyuth10
 
e-KSF Process Sheets
e-KSF Process Sheetse-KSF Process Sheets
e-KSF Process Sheets
Shaun Wilde
 
Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1
Haytham Ghandour
 
Validation type 'special' in value sets
Validation type 'special' in value setsValidation type 'special' in value sets
Validation type 'special' in value sets
Feras Ahmad
 
xCP2 0 Performance Best Practices and Guidelines
xCP2 0 Performance Best Practices and GuidelinesxCP2 0 Performance Best Practices and Guidelines
xCP2 0 Performance Best Practices and Guidelines
Haytham Ghandour
 
Oracle Fusion Role Mappings
Oracle Fusion Role MappingsOracle Fusion Role Mappings
Oracle Fusion Role Mappings
Feras Ahmad
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
Amit Sharma
 
Fast formula in Fusion Cloud HCM
Fast formula in Fusion Cloud HCMFast formula in Fusion Cloud HCM
Fast formula in Fusion Cloud HCM
Feras Ahmad
 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-lab
Amit Sharma
 
Oracle EMC 12C Grand Tour
Oracle EMC 12C Grand TourOracle EMC 12C Grand Tour
Oracle EMC 12C Grand Tour
Rakesh Gujjarlapudi
 
Configuring Parallel Approvers Notification
Configuring Parallel Approvers NotificationConfiguring Parallel Approvers Notification
Configuring Parallel Approvers Notification
Feras Ahmad
 

What's hot (19)

Java 14 support in Eclipse IDE
Java 14 support in Eclipse IDEJava 14 support in Eclipse IDE
Java 14 support in Eclipse IDE
 
Tutorial%20fivestar%20cck%20views
Tutorial%20fivestar%20cck%20viewsTutorial%20fivestar%20cck%20views
Tutorial%20fivestar%20cck%20views
 
Oracle Apps INVENTORY
Oracle Apps INVENTORY Oracle Apps INVENTORY
Oracle Apps INVENTORY
 
Type Adoption in xCP 2.1 Applications
Type Adoption in xCP 2.1 ApplicationsType Adoption in xCP 2.1 Applications
Type Adoption in xCP 2.1 Applications
 
People soft workflow by surya 2
People soft workflow by surya 2People soft workflow by surya 2
People soft workflow by surya 2
 
Creating Workflows Windows Share Point Services
Creating Workflows Windows Share Point ServicesCreating Workflows Windows Share Point Services
Creating Workflows Windows Share Point Services
 
Test script
Test scriptTest script
Test script
 
Workflow functional concept on openerp7
Workflow functional concept on openerp7Workflow functional concept on openerp7
Workflow functional concept on openerp7
 
Sap ps module tutorial
Sap ps module tutorialSap ps module tutorial
Sap ps module tutorial
 
e-KSF Process Sheets
e-KSF Process Sheetse-KSF Process Sheets
e-KSF Process Sheets
 
Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1
 
Validation type 'special' in value sets
Validation type 'special' in value setsValidation type 'special' in value sets
Validation type 'special' in value sets
 
xCP2 0 Performance Best Practices and Guidelines
xCP2 0 Performance Best Practices and GuidelinesxCP2 0 Performance Best Practices and Guidelines
xCP2 0 Performance Best Practices and Guidelines
 
Oracle Fusion Role Mappings
Oracle Fusion Role MappingsOracle Fusion Role Mappings
Oracle Fusion Role Mappings
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
Fast formula in Fusion Cloud HCM
Fast formula in Fusion Cloud HCMFast formula in Fusion Cloud HCM
Fast formula in Fusion Cloud HCM
 
Sales force certification-lab
Sales force certification-labSales force certification-lab
Sales force certification-lab
 
Oracle EMC 12C Grand Tour
Oracle EMC 12C Grand TourOracle EMC 12C Grand Tour
Oracle EMC 12C Grand Tour
 
Configuring Parallel Approvers Notification
Configuring Parallel Approvers NotificationConfiguring Parallel Approvers Notification
Configuring Parallel Approvers Notification
 

Similar to Flavours - Classic/Technical BDD

IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
David Harrison
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
David Harrison
 
Getting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
Getting Started with Nastel AutoPilot Business Views and Policies - a TutorialGetting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
Getting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
Sam Garforth
 
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docxPURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
amrit47
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabh
guestd83b546
 
Web sphere application server performance tuning workshop
Web sphere application server performance tuning workshopWeb sphere application server performance tuning workshop
Web sphere application server performance tuning workshop
Rohit Kelapure
 
PagesToGo.pdf
PagesToGo.pdfPagesToGo.pdf
PagesToGo.pdf
David Harrison
 
]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3
Klaus Hofeditz
 
Developer's guide to customization
Developer's guide to customizationDeveloper's guide to customization
Developer's guide to customization
Ahmed Farag
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
Mădălin Ștefîrcă
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
willmation
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
Robin O'Brien
 
Diving into VS 2015 Day5
Diving into VS 2015 Day5Diving into VS 2015 Day5
Diving into VS 2015 Day5
Akhil Mittal
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
vchircu
 
Readme
ReadmeReadme
Readme
rec2006
 
CAD Report
CAD ReportCAD Report
CAD Report
Jyoti Tyagi
 
Tdd,Ioc
Tdd,IocTdd,Ioc
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdfAZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
NithinRoy12
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011
David O'Dowd
 
Cucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criteriasCucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criterias
Geison Goes
 

Similar to Flavours - Classic/Technical BDD (20)

IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
Getting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
Getting Started with Nastel AutoPilot Business Views and Policies - a TutorialGetting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
Getting Started with Nastel AutoPilot Business Views and Policies - a Tutorial
 
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docxPURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabh
 
Web sphere application server performance tuning workshop
Web sphere application server performance tuning workshopWeb sphere application server performance tuning workshop
Web sphere application server performance tuning workshop
 
PagesToGo.pdf
PagesToGo.pdfPagesToGo.pdf
PagesToGo.pdf
 
]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3
 
Developer's guide to customization
Developer's guide to customizationDeveloper's guide to customization
Developer's guide to customization
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1Behaviour Driven Development V 0.1
Behaviour Driven Development V 0.1
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
Diving into VS 2015 Day5
Diving into VS 2015 Day5Diving into VS 2015 Day5
Diving into VS 2015 Day5
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 
Readme
ReadmeReadme
Readme
 
CAD Report
CAD ReportCAD Report
CAD Report
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdfAZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
AZ - 400 olih orcle Implementing Microsoft DevOps (1).pdf
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011
 
Cucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criteriasCucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criterias
 

More from David Harrison

SchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfSchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdf
David Harrison
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
David Harrison
 
Processor Refactoring.pdf
Processor Refactoring.pdfProcessor Refactoring.pdf
Processor Refactoring.pdf
David Harrison
 
Generation_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdfGeneration_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdf
David Harrison
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
David Harrison
 
Generation_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfGeneration_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdf
David Harrison
 
Generation_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdfGeneration_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdf
David Harrison
 
Generation_XSD_Article.docx
Generation_XSD_Article.docxGeneration_XSD_Article.docx
Generation_XSD_Article.docx
David Harrison
 
High sierra part 1
High sierra part 1High sierra part 1
High sierra part 1
David Harrison
 
Selenium Testing @ Agile Speed
Selenium Testing @ Agile SpeedSelenium Testing @ Agile Speed
Selenium Testing @ Agile Speed
David Harrison
 
Workflow Test Automation
Workflow Test AutomationWorkflow Test Automation
Workflow Test Automation
David Harrison
 
Et sensus agile documentation
Et sensus   agile documentationEt sensus   agile documentation
Et sensus agile documentation
David Harrison
 
Web Test Automation
Web Test AutomationWeb Test Automation
Web Test Automation
David Harrison
 

More from David Harrison (13)

SchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfSchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdf
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
 
Processor Refactoring.pdf
Processor Refactoring.pdfProcessor Refactoring.pdf
Processor Refactoring.pdf
 
Generation_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdfGeneration_XSD_Article - Part 4.pdf
Generation_XSD_Article - Part 4.pdf
 
PhoenixRisingArticle.pdf
PhoenixRisingArticle.pdfPhoenixRisingArticle.pdf
PhoenixRisingArticle.pdf
 
Generation_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfGeneration_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdf
 
Generation_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdfGeneration_XSD_Article - Part 2.pdf
Generation_XSD_Article - Part 2.pdf
 
Generation_XSD_Article.docx
Generation_XSD_Article.docxGeneration_XSD_Article.docx
Generation_XSD_Article.docx
 
High sierra part 1
High sierra part 1High sierra part 1
High sierra part 1
 
Selenium Testing @ Agile Speed
Selenium Testing @ Agile SpeedSelenium Testing @ Agile Speed
Selenium Testing @ Agile Speed
 
Workflow Test Automation
Workflow Test AutomationWorkflow Test Automation
Workflow Test Automation
 
Et sensus agile documentation
Et sensus   agile documentationEt sensus   agile documentation
Et sensus agile documentation
 
Web Test Automation
Web Test AutomationWeb Test Automation
Web Test Automation
 

Recently uploaded

假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
harveenkaur52
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
nhiyenphan2005
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
zoowe
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
cuobya
 

Recently uploaded (20)

假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
 

Flavours - Classic/Technical BDD

  • 1. FLAVOURS BDD Flavours (Cucumber/Gherkin)/Karate D. Harrison March 2021 © 2021, David Harrison, All Rights Reserved
  • 2. Table of CONTENTS Introduction.............................................................................1 The Classic Form ......................................................................2 The Technical Form ..................................................................5 Test Runner.............................................................................8 Test Execution .........................................................................9 Remarks ............................................................................... 11
  • 3. INTRODUCTION Behaviour Driven Development [here], which in the case of test automation might be better termed Behaviour Driven Test Automation (BDTA), relies on the use of a spoken language-style set of statements as the starting point in the development of tests for an application. However, in today’s landscape of test automation there appears to be two flavours of BTDA; one that can usefully be termed the Classic, and one that might be termed Technical. The fundamental technology in both cases is the use of the Gherkin [here] language to describe a unit of testing, a Scenario, which in the case of the classic form, via a Step Definition file, enact the appropriate actions and validations. In the technical form no such code-behind is required. In the Java world this Gherkin language form is hosted in an environment called Cucumber [here]. Alternatively, in the C# world this Gherkin syntax is hosted in an environment called SpecFlow [here]. The technical form of BDD is exemplified by the tests written using the Karate framework [here]. This framework can be used in both Java (IntelliJ) [here] and C# (VSCode) [here] development environments. Let us look at these two BDD forms, in the context of crud operations in a target application and identify and compare their key characteristics.
  • 4. 2 The Classic Form The classic form of BDD might usefully be characterised by the following example: In this example, the Scenario Outline test validates workflow of an application related to “creating” a “business object” in the persistent store. The Examples table specifies that the object is in fact a “Customer”. Of course, for a full CRUD feature set we would need to write tests for “updating” and “deleting” and ensure that all such Scenarios are synchronised on the same business object. As can be seen, the test describes the UI-based user journey required to achieve the desired outcome, creating a Customer business object. Behind the scenes these statements link, via the default Cucumber text matching approach, to Step Definition statements, for example, as illustrated in the fragment below:
  • 5. 3 The solution shown here reflects the pattern described in the earlier article “UI Testing Pattern” [here]. The testing focusses on the user workflow to assert that a “business-object” has been successfully added to the persistent store of the application. The assertion necessarily needs to be made in the “@After” method associated with the
  • 6. 4 executing Cucumber test and uses a utility class to query the back-end database for a specific entry, the details of which are held in the testContextJava object. Further Scenarios will necessarily need to be written to cover the workflows associated with the update and delete aspects of “CRUD”. These additional Scenarios would need to be synchronised to focus on the appropriate common data. As normal in testing we should aim to delete what we add to a system when we test. In the target application the front end is connected to the back end via RESTful services, so, given this, we could assert the correctness of this business operation in a more fundamental way than that offered by exercising the front- end – enter Karate and API testing.
  • 7. 5 The Technical Form The technical form of BDD is characterised by tests written using the Karate framework [here]. The focus of Karate is to permit fast and consistent testing of APIs and has the bonus that it does not require code-behind Step Definitions to be written. It should be noted that this framework cannot co-exist with the classic form in a project. We will be using the backend RESTful API of the application that was used above and that was introduced in “UI Testing Pattern” [here], as the basis of our tests. Specifically, we will look at the CRUD operation for the Customer business object. An example Karate test is as shown below, testing the CRUD operations associated with “customers”:
  • 8. 6
  • 9. 7 Here we see a Feature, “Customers-related CRUD process”, together with a Background section and single Scenario Outline “Customers CRUD operations”, in which the (create/update/delete) operations offered by a RESTful API are being exercised. This API is one of those offered by the backend of the application introduced in the article “UI Testing Pattern” [here]. In this API it is necessary to firstly get an identity token which will be used in the header of subsequent calls, and this is what is happening in the initial block (lines 14-24). Once this is obtained, it is used as a “bearer” token in the header of the “create” call configured and initiated in the following block (lines 27-53). We then see a block that performs the “update” action (lines 54-66) followed by one that performs the “delete” (lines 68-86). In lines 27-30 it should be noted how we make use of Karate’s Java interop mechanism to construct random data for our Customers object. The class, JavaUtils, is in the Karate project and provides a range of static helper methods. In line 50, 80 and 85 we use another supporting Java type, JavaDbUtils, which provides database-related methods, to enable assertions to be made related to record counting as well as table entry deletion. It should be noted that the application currently only marks “deleted” table entries with a non-null
  • 10. 8 deletedAt field value corresponding to the (GMT) delete-time. To actually clean up after our test we need to perform a SQL delete operation with an appropriate where clause. In this test we see keywords like “Given”, “And”, “When” and “Then”, echoing the classic BDD form, but now they act as prefixes to more technically focused statements. No code-behind is needed in order to have a functioning test case. We can also see how the “* def”, definitional statement is quite prevalent, setting up the various data elements used in requests and so on. In our case, using the business object Customers, the API does not provide data in the responses, hence we do not need to use the powerful matcher capabilities of the framework to assert the correctness of response fields. However, we do need to assert that the “create” and “delete” work as expected, we do not want to just rely on getting an API success status. In these cases, as noted earlier, we use, special Java types to directly query the backend database and ensure that these operations are indeed successful. Test Runner To run our tests, we need a simple runner class, this is shown below: Right clicking on the green glyph at line 8 and choosing “Run testCustomers_CRUD()” or “Debug testCustomers_CRUD()” causes our test to run (in the appropriate execution mode). The run command, instead of simply referencing a feature file name, can have a chained set of tags referencing specific Scenario or Scenario Outline tests that you want to have executed.
  • 11. 9 Test Execution The tests as shown here where developed and run within the IntelliJ IDE. In the console, the most basic form of test output, we see: 20:36:22.390 [main] INFO com.intuit.karate - [print] Token URL: http://localhost:8080/api/auth/sign-in 20:36:23.734 [main] INFO com.intuit.karate - [print] Token rqst response: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImIyNGI4YTQwLWE1MmItNDIxNi05MmZmLWZhYjYwMmNhNTZjMiIsImlhdCI6MTYxO TExNjU4MywiZXhwIjoxNjE5NzIxMzgzfQ.UpAmVLfCV4zkZkX42ttr4rkvZofHSVrDX4EpPhvacos 20:36:23.777 [main] INFO com.intuit.karate - [print] Customer Number : 1258 20:36:23.780 [main] INFO com.intuit.karate - [print] Customer Telephone Number: 0048596849309 20:36:23.782 [main] INFO com.intuit.karate - [print] Customer Zip Code : 4331 20:36:23.786 [main] INFO com.intuit.karate - [print] Customer Name : Harrison Models635 AG 20:36:24.038 [main] INFO com.intuit.karate - [print] After CREATE, WHERE clause: customerName='Harrison Models635 AG' AND deletedAt IS NULL 20:36:25.117 [main] INFO com.intuit.karate - [print] POST response: { "country": "Switzerland", "city": "Elgg", "contactFirstName": "David", "postalCode": "4331", "salesRepEmployeeNumber": { "officeCodeId": null, "lastName": "Jones", "extension": null, "jobTitle": null, "reportsToId": null, "updatedById": "b24b8a40-a52b-4216-92ff-fab602ca56c2", "employeeNumber": 1504, "firstName": "Barry", "createdAt": "2021-04-21T13:45:19.000Z", "deletedAt": null, "importHash": null, "tenantId": "7c4ac4a7-c1ad-4e02-b3ff-974693ae8719", "id": "b242b72e-115e-44bc-981b-870cb404118a", "email": null, "createdById": "b24b8a40-a52b-4216-92ff-fab602ca56c2", "updatedAt": "2021-04-21T13:45:19.000Z" }, "customerNumber": 1258, "updatedById": "b24b8a40-a52b-4216-92ff-fab602ca56c2", "customerName": "Harrison Models635 AG", "createdAt": "2021-04-22T18:36:23.000Z", "deletedAt": null, "importHash": null, "phone": "0048596849309", "salesRepEmployeeNumberId": "b242b72e-115e-44bc-981b-870cb404118a", "tenantId": "7c4ac4a7-c1ad-4e02-b3ff-974693ae8719", "addressLine1": "Stutzstrasse 10a", "creditLimit": "3500.00", "addressLine2": null, "id": "5ad1e62f-5676-4258-805a-6dd0b8fdcf28", "state": "Zurich", "createdById": "b24b8a40-a52b-4216-92ff-fab602ca56c2", "updatedAt": "2021-04-22T18:36:23.000Z" } 20:36:25.547 [main] INFO com.intuit.karate - [print] After DELETE(1), WHERE clause: customerName='Harrison Models635 AG(2)' AND deletedAt IS NOT NULL 20:36:25.623 [main] INFO com.intuit.karate - [print] After DELETE(2), WHERE clause: customerName='Harrison Models635 AG(2)' --------------------------------------------------------- feature: classpath:karate/Customers/Customers_CRUD.feature scenarios: 1 | passed: 1 | failed: 0 | time: 3.2691 However, as with the classic BDD form, Karate produces an HTML report which is referenced in the console and this looks much more visual:
  • 12. 10 Of course, in our case we only see one entry. In a production environment the volume of results would be very much greater.
  • 13. 11 Remarks We have shown how the two forms of BDD style, classic and technical, can be used for automated testing. The two forms apply in quite distinct areas of testing, one, the classic, is particularly good at expressing business-level workflow, user-journeys. The technical form, on the other hand, is particularly good at the testing of APIs, whether SOAP or RESTful. It can also be used for testing GraphQL [here] interfaces. Its use of the Cucumber/Gherkin keywords is rather a case of syntactic sugar and should not be taken to indicate any wider conformity with the classic approach. We have shown how identity tokens, required as part of the header in each API call, can be handled as well as how Java types can be factored into a test case, thus providing more complex operations than offered by the framework. As well as RESTful, SOAP APIs and GraphQL, Karate has been extended to provide testing support for gRPC interfaces [here]. This topic will be specifically covered in a later article. The two approaches complement each other perfectly – a great pair of tools for any test automation toolbox.