Keyword-Driven Framework using TestCafé (beta)
This is the Keyword-Driven framework plugin for TestCafé.
TestCafé Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing.
To install this TestCafé Keyword-Driven Framework
- run the command
npm i keyword_driven
.
Usage
- add to the testcafe command-line the following options:
testcafe chrome ./path-to-tests/*
To execute the solution
- Ensure that Node.js and npm are installed on your computer and run the following command:.
-
install testcafe (version >=1.4.1):
npm i -g testcafe
-
install xlsx (version >= 0.15.1):
npm i xlsx
-
Create a
keyword-driven.js
file at the project root:
;; fixture `Getting Started` page `https://devexpress.github.io/testcafe/documentation/getting-started/`; var XLSX = var workbook = XLSX;var sheet_name_list = workbookSheetNames;var xlData = XLSXutils; ;
- Create the following script in the
xpath-selector.js
file for handlingXPath
:
; const elementByXPath = ; { return ;}
- run the command
testcafe chrome keyword-driven.js
Error rendering
- this execution will report for each file reported in the stack trace.
C:\ProcessDrive\TestCafe\Trails\Keyword_Driven>testcafe chrome Keyword-Driven.js
Running tests in:
- Chrome 76.0.3809 / Windows 10.0.0
Getting Started
× Keyword-Driven
1) The element that matches the specified selector is not visible.
Browser: Chrome 76.0.3809 / Windows 10.0.0
21 | switch (element.Keyword) {
22 | case "navigateTo":
23 | await t[element.Keyword](element.Parameter)
24 | break;
25 | case "click":
> 26 | await t[element.Keyword](XPath(element.LocatorValue))
27 | break;
28 | case "typeText":
29 | await t[element.Keyword](XPath(element.LocatorValue), element.Parameter)
30 | break;
31 | case "select":
element.Keyword ="click"
const interfaceSelect = XPath(element.LocatorValue);
await t [element.Keyword](interfaceSelect)
await t [element.Keyword](interfaceSelect.find('option').withText(element.Parameter))
at <anonymous> (C:\ProcessDrive\TestCafe\Trails\Keyword_Driven\Keyword-Driven.js:26:27)
1/1 failed (1m 33s)
Screenshot rendering
- this reporter embeds all screenshots as base 64 images, making the generated json file completely autonomous.
Video rendering
- this video embeds all actions as .mp4, making the generated .mp4 file completely autonomous.
Logger rendering
- this logger embeds all information about the execution as a html report, making the generated html file completely autonomous with suite of logs, Screenshots, .mp4.
Mail rendering
- this making the emailable logger file completely autonomous.
Utility
testCafe
enables to execute the keyword-Driven solution.xlsx
enables to read the excel file with data dynamically from the ./path-to-read/*(.xlsx).xpath-selector.js
enables to access the xpath(LocatorValue).log4js
used to log messages for a specific test.For more details please refer.