Skip to content

Instantly share code, notes, and snippets.

View ViniciusResende's full-sized avatar
🤓
Studying to develop my skills.

Vinícius Alves de Faria Resende ViniciusResende

🤓
Studying to develop my skills.
View GitHub Profile

Evolving Our Test Architecture: A Layered BDD Approach

To support the planned growth of our test suite and ensure it remains "mindful," scalable, and maintainable, we will evolve its architecture.

Our goal is to create a highly readable and reusable structure that separates behavioral definitions from implementation logic. We will achieve this by integrating Behavior-Driven Development (BDD) and introducing a layered-action architecture.

1. Adopting BDD with Cucumber

To make our tests understandable for all stakeholders (including product owners) and to link them directly to our Software Testing Protocol, we will adopt Gherkin/Cucumber. Playwright can be integrated with a Cucumber runner (@cucumber/cucumber), allowing us to define our tests in plain-English .feature files.

*verifyBrandsURLsActiveness(brandsURLs) {
const brandsArray = ['americanas', 'submarino', 'shoptime']
return yield Object.values(brandsURLs).reduce(function*(acc, urlObject, idx) {
let urlDoesExists;
const turboApiUrl = `${turboApiConfig[brandsArray[idx]]}/${urlObject.path}`
try {
const { statusCode } = yield rp({
url: turboApiUrl,
*verifyBrandsURLsActiveness(brandsURLs) {
function* getTurboRequestStatusCode(brand) {
try {
const { statusCode } = yield rp({
url: `${turboApiConfig[brand]}/${brandsURLs[brand].path}`,
resolveWithFullResponse: true,
timeout: 5000
})
return statusCode;