Slide 1

Slide 1 text

TESTING LAMBDA-BASED APPLICATIONS USING CYPRESS IS A WAY TO GO?

Slide 2

Slide 2 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 3

Slide 3 text

Serverless is a cloud-native development model that allows developers to build and run applications without having to manage servers. There are still servers in serverless, but they are abstracted away from app development. Once deployed, serverless apps respond to demand and automatically scale up and down as needed. Serverless offerings from public cloud providers are usually metered on-demand through an event-driven execution model. SERVERLESS - CONCEPT

Slide 4

Slide 4 text

Serverless is a cloud-native development model that allows developers to build and run applications without having to manage servers. There are still servers in serverless, but they are abstracted away from app development. Once deployed, serverless apps respond to demand and automatically scale up and down as needed. Serverless offerings from public cloud providers are usually metered on-demand through an event-driven execution model. SERVERLESS - CONCEPT

Slide 5

Slide 5 text

Serverless is a cloud-native development model that allows developers to build and run applications without having to manage servers. There are still servers in serverless, but they are abstracted away from app development. Once deployed, serverless apps respond to demand and automatically scale up and down as needed. Serverless offerings from public cloud providers are usually metered on-demand through an event-driven execution model. SERVERLESS - CONCEPT

Slide 6

Slide 6 text

Serverless is a cloud-native development model that allows developers to build and run applications without having to manage servers. There are still servers in serverless, but they are abstracted away from app development. Once deployed, serverless apps respond to demand and automatically scale up and down as needed. Serverless offerings from public cloud providers are usually metered on-demand through an event-driven execution model. SERVERLESS - CONCEPT

Slide 7

Slide 7 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 8

Slide 8 text

SERVERLESS - COMPONENTS EVENT SOURCE FUNCTION SERVICES cron job change in data state endpoint request resource state cron job change in data state endpoint request resource state cron job change in data state endpoint request resource state

Slide 9

Slide 9 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 10

Slide 10 text

SERVERLESS - ANATOMY OF A SERVERLESS FUNCTION HANDLER FUNCTION EVENT OBJECT CONTEXT OBJECT function to be executed upon invocation data sent during lambda function invocation methods available to interact with runtime information (request id, log group, etc)

Slide 11

Slide 11 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 12

Slide 12 text

SERVERLESS - SAM } The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications It provides shorthand syntax to express functions, APIs, databases, and event source mappings With just a few lines per resource, you can define the application you want and model it using YAML

Slide 13

Slide 13 text

SERVERLESS - SAM } The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications It provides shorthand syntax to express functions, APIs, databases, and event source mappings With just a few lines per resource, you can define the application you want and model it using YAML

Slide 14

Slide 14 text

SERVERLESS - SAM } The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications It provides shorthand syntax to express functions, APIs, databases, and event source mappings With just a few lines per resource, you can define the application you want and model it using YAML

Slide 15

Slide 15 text

SERVERLESS - SAM AWS SAM template (example) {

Slide 16

Slide 16 text

SERVERLESS - SAM SAM CLI {is an open-source CLI tool that helps you develop serverless applications containing Lambda functions, Step Functions, API Gateway, EventBridge, SQS, SNS and more

Slide 17

Slide 17 text

SERVERLESS - SAM SAM CLI (commands) { start-api COMMANDS COMMAND allows to set up a local endpoint that you can use to test your API allows to set up a local endpoint to invoke your local lambda functions start-lambda

Slide 18

Slide 18 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 19

Slide 19 text

TESTING - WHERE AND WHAT TO TEST IN A LAMBDA FUNCTION SOURCE (DEV) STAGING PROD lint unit tests successful build - if applies integration tests - aws SAM CLI - some test framework/library safe deploy - traffic-shifting - auto-publish - rollback strategy

Slide 20

Slide 20 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 21

Slide 21 text

CYPRESS - CONCEPT Cypress is a purely JavaScript-based front-end testing tool built for the modern web. It aims to address the pain points developers or QA engineers face while testing an application. Cypress is a more developer-friendly tool that uses a unique DOM manipulation technique and operates directly in the browser.

Slide 22

Slide 22 text

CYPRESS - CONCEPT Cypress is a purely JavaScript-based front-end testing tool built for the modern web. It aims to address the pain points developers or QA engineers face while testing an application. Cypress is a more developer-friendly tool that uses a unique DOM manipulation technique and operates directly in the browser.

Slide 23

Slide 23 text

CYPRESS - CONCEPT Cypress is a purely JavaScript-based front-end testing tool built for the modern web. It aims to address the pain points developers or QA engineers face while testing an application. Cypress is a more developer-friendly tool that uses a unique DOM manipulation technique and operates directly in the browser.

Slide 24

Slide 24 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 25

Slide 25 text

CYPRESS - HOW IT WORKS

Slide 26

Slide 26 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 27

Slide 27 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Embedded HTTP library uses publish - subscribe approach Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 28

Slide 28 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Embedded HTTP library uses publish - subscribe approach Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 29

Slide 29 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Embedded HTTP library uses publish - subscribe approach Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 30

Slide 30 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Embedded HTTP library uses publish - subscribe approach Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 31

Slide 31 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Embedded HTTP library uses publish - subscribe approach Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 32

Slide 32 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other

Slide 33

Slide 33 text

STRENGTHS DRAWBACKS UI for test run Easy test debug through browser Retrying tests for a certain time until they succeed or finally fail Easy setup to generate reports Great collection of libraries CYPRESS - STRENGTHS AND DRAWBACKS Runs through a browser giving a slow performance The framework was done for E2E UI testing, even it works for other purposes

Slide 34

Slide 34 text

TOPICS 1. SERVERLESS 1.1. CONCEPT 1.2. COMPONENTS 1.3. ANATOMY OF A SERVERLESS FUNCTION 1.4. SERVERLESS APPLICATION MODEL (SAM) 2. TESTING 2.1. WHERE AND WHAT TO TEST A LAMBDA PROJECT 3. CYPRESS 3.1. CONCEPT 3.2. HOW IT WORKS 3.3. STRENGTHS AND DRAWBACKS 3.4. IS A WAY TO GO OR NOT

Slide 35

Slide 35 text

CYPRESS - IS A WAY TO GO OR NOT MAYBE DEFINITELY NOT NO YES DEFINITELY YES CYPRESS FOR LAMBDA FUNCTIONS TESTING 0 1 2 -1 -2 UNIT TESTING DEFINITELY NOT INTEGRATION TESTING DEFINITELY NOT E2E TESTING YES MANUAL TESTING (HUMAN TRIGGERING) DEFINITELY YES CONTINUOUS INTEGRATION TESTING MAYBE RESULT NO

Slide 36

Slide 36 text

THAT’S ALL FOLKS! @YURIREEIS