SlideShare a Scribd company logo
1 of 87
Download to read offline
Intro to React Native Testing Library
While we're waiting to start, if you're comfortable, share
your answer to the following question in the chat:
What do you want to learn about testing in this workshop?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Intro to React Native Testing Library
https://rnte.st/london22
Clone the repo, build, and test!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Josh Justice
CodingItWrong.com
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
ReactNativeTesting.io
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What We'll Cover
— React Native Testing Library
— Jest Native
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What We Won't Cover
— Jest basics
— End-to-end testing (Detox, Appium)
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Learning More Afterward
— https://rnte.st/london22
— Discord community
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
02 Component Tests:
Rendering
Intro to React Native Testing
Library
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What is a component test?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
React Native Testing Library
@testing-library/react-native
callstack.github.io/react-native-testing-library
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What to test?
— Call methods/functions?
— Check state values?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
"We don’t encourage reading implementation details
like state variables themselves…Instead, test observable
behavior — i.e. what your component renders or does."
-- @dan_abramov, 2019-03-06 tweet
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
"A component contract is the agreement between a
component and the rest of the application."
-- Edd Yerburgh, Testing Vue.js Applications
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
"Other components can assume the component will
fulfill its contractual agreement and produce the agreed
output if it’s provided the correct input."
-- Edd Yerburgh, Testing Vue.js Applications
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Question: what are some of the kinds of inputs and
outputs that components have?
Answer in the chat!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
— Rendered UI
— Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
— Rendered UI
— Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Getter Functions
— screen.getByText
— screen.getByLabelText
— screen.getByPlaceholder
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Text
return <Text>Hello, world!</Text>;
screen.getByText('Hello, world!')
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
TextInput
return <TextInput placeholder="Enter your name" ... />;
screen.getByPlaceholderText('Enter your name')
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Image
return (
<Image source={...} accessibilityLabel="squirrel waving" />
);
screen.getByLabelText('squirrel waving')
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
SVG
import WavingHand from './assets/waving-hand.svg';
return <WavingHand accessibilityLabel="waving hand" />;
screen.getByLabelText('waving hand')
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Query Functions
— screen.queryByText
— screen.queryByLabelText
— screen.queryByPlaceholder
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Which Query Should I Use?
https://callstack.github.io/react-native-testing-library/docs/how-should-i-query
"your test should resemble how users interact with your
code (component, page, etc.) as much as possible"
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Which Query Should I Use?
https://callstack.github.io/react-native-testing-library/docs/how-should-i-query
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Note on getByRole()
screen.getByRole('button', {name: 'Save Changes'})
— Likely going to be the top recommendation soon
— Feature needed first: implicit roles (Pressables
queryable as button by default)
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Confirming Presence
expect(screen.getBy…()).toBeVisible();
As of jest-native 5.1
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Confirming Presence -Alternatives
expect(screen.getBy…()).toBeTruthy();
expect(screen.queryBy…()).toBeTruthy();
screen.getBy…();
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Confirming Presence
expect(screen.getBy…()).toBeVisible();
✅
Gives best error message
✅
Looks like an expectation
✅
Does extra visibility checking for realism
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Confirming Absence
expect(screen.queryBy…()).toBeNull();
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
— Rendered UI
— Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
- User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Exercise 1
— intro-to-rntl-exercises
— exercises/1-Exercise1.md
For help:
reactnativetesting.io/component/testing/
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
A few more notes about testing
rendering and props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing content,
not appearance.
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What about snapshot tests?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
import renderer from 'react-test-renderer';
import Hello from './Hello';
it('renders correctly', () => {
const tree = renderer.create(<Hello name="Josh" />).toJSON();
expect(tree).toMatchSnapshot();
});
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
03 Component Tests:
Actions and Mocks
Intro to React Native Testing
Library
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
- User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
- User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
import {render, fireEvent} from '@testing-library/react-native';
describe('NewMessageForm', () => {
describe('pressing send', () => {
it('clears the message field', () => {
render(<NewMessageForm />);
fireEvent.changeText(
screen.getByPlaceholderText('Message'),
'Hello world',
);
fireEvent.press(screen.getByText('Send'));
expect(screen.getByPlaceholderText('Message')).toHaveProp('value', '');
});
});
});
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
fireEvent
import {fireEvent} from '@testing-library/react-native';
fireEvent.press(element)
fireEvent.changeText(element, text)
fireEvent.scroll(element, eventData)
fireEvent(element, eventName, eventData)
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
import {render, fireEvent} from '@testing-library/react-native';
describe('NewMessageForm', () => {
describe('pressing send', () => {
it('clears the message field', () => {
render(<NewMessageForm />);
fireEvent.changeText(
screen.getByPlaceholderText('Message'),
'Hello world',
);
fireEvent.press(screen.getByText('Send'));
expect(screen.getByPlaceholderText('Message')).toHaveProp('value', '');
});
});
});
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
toHaveProp
Provided by Jest Native
expect(...).toHaveProp('propName', 'propValue');
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
- User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
✅
User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
✅
User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Mock Functions
jestjs.io/docs/mock-functions
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Creating a New Mock Function
const myMockFunction = jest.fn().mockName('myMockFunction');
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Mock Matchers
expect(myMock).toHaveBeenCalled();
expect(myMock).toHaveBeenCalledWith(param, otherParam, ...);
expect(myMock).toHaveBeenCalledWith(expect.any(String));
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
it('calls the send handler', () => {
const messageText = 'Hello world';
const sendHandler = jest.fn().mockName('sendHandler');
render(<NewMessageForm onSend={sendHandler} />);
fireEvent.changeText(
screen.getByPlaceholderText('Message'),
messageText,
);
fireEvent.press(screen.getByText('Send'));
expect(sendHandler).toHaveBeenCalledWith(messageText);
});
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Are mocks
Testing implementation
details?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
No, mocks are an essential part of
Testing the contract.
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
✅
User interaction events
Outputs:
✅
Rendered UI
- Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
✅
Props
✅
User interaction events
Outputs:
✅
Rendered UI
✅
Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Exercise 2
— intro-to-rntl-exercises
— exercises/2-Exercise2.md
For help:
reactnativetesting.io/component/testing/#interaction
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Testing the Contract
Inputs:
— Props
— User interaction events
Outputs:
— Rendered UI
— Calls to function props
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
04 Component Tests:
Effects and Module Mocks
Intro to React Native Testing
Library
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
How can we test effects?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
How can we test effects?
Test the effect/result.
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Data loading effects hit the API
Problem?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Options for Mocking Web Service Requests
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Options for Mocking Web Service Requests
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Jest Module Mocks
jestjs.io/docs/mock-functions#mocking-modules
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
import {render, screen} from '@testing-library/react-native';
import WidgetContainer from './WidgetContainer';
import api from './api';
jest.mock('./api');
describe('WidgetContainer', () => {
it('loads widgets upon first render', async () => {
api.get.mockResolvedValue({/* the response object */});
render(<WidgetContainer />);
await screen.findByText('Widget 1'));
expect(screen.getByText('Widget 2')).toBeVisible();
expect(api.get).toHaveBeenCalledWith('/widgets');
});
});
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
mockedModule.myfunc.mockReturnValue(val);
mockedModule.myfunc.mockResolvedValue(val);
mockedModule.myfunc.mockRejectedValue(val);
jestjs.io/docs/mock-function-api
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Getter Functions
— screen.getByText
— screen.getByLabelText
— screen.getByPlaceholder
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Find Functions
— screen.findByText
— screen.findByLabelText
— screen.findByPlaceholder
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Exercise 3
— intro-to-rntl-exercises
— exercises/3-Exercise3.md
For help:
reactnativetesting.io/component/testing.html
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
act() Error
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
To the code!
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
05 Wrap-up
Intro to React Native Testing
Library
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
What did we learn?
— What does it mean to test the contract?
— Why test the contract?
— What are the inputs and outputs of a component?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Remaining Questions?
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Continuing the Learning
— https://rnte.st/london22
— Discord community
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
Thanks!
Josh Justice
josh.justice@testdouble.com
https://rnte.st/london22
Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22

More Related Content

What's hot

Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start GuideAndrii Gakhov
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenarioArnauld Loyer
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellThomas Pierrain
 
Introducción a Wiremock
Introducción a WiremockIntroducción a Wiremock
Introducción a WiremockJose Ortiz
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at FrosconKris Buytaert
 
Deep dive into swift UI
Deep dive into swift UIDeep dive into swift UI
Deep dive into swift UIOsamaGamal26
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 
API Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIsAPI Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIsAaronLieberman5
 
Designing APIs with OpenAPI Spec
Designing APIs with OpenAPI SpecDesigning APIs with OpenAPI Spec
Designing APIs with OpenAPI SpecAdam Paxton
 
Detox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationDetox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationViktorija Sujetaitė
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow soloviniciusban
 
API Management Part 1 - An Introduction to Azure API Management
API Management Part 1 - An Introduction to Azure API ManagementAPI Management Part 1 - An Introduction to Azure API Management
API Management Part 1 - An Introduction to Azure API ManagementBizTalk360
 
Automating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationAutomating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationSebastian Wagner
 
A Definition of Done for DevSecOps
A Definition of Done for DevSecOpsA Definition of Done for DevSecOps
A Definition of Done for DevSecOpsGene Gotimer
 
Microservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactMicroservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactAraf Karsh Hamid
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD processHYS Enterprise
 

What's hot (20)

Swagger / Quick Start Guide
Swagger / Quick Start GuideSwagger / Quick Start Guide
Swagger / Quick Start Guide
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenario
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shell
 
Introducción a Wiremock
Introducción a WiremockIntroducción a Wiremock
Introducción a Wiremock
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at Froscon
 
JHipster overview
JHipster overviewJHipster overview
JHipster overview
 
Deep dive into swift UI
Deep dive into swift UIDeep dive into swift UI
Deep dive into swift UI
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
API Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIsAPI Security - Everything You Need to Know To Protect Your APIs
API Security - Everything You Need to Know To Protect Your APIs
 
Designing APIs with OpenAPI Spec
Designing APIs with OpenAPI SpecDesigning APIs with OpenAPI Spec
Designing APIs with OpenAPI Spec
 
Detox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationDetox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automation
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
CI/CD with Github Actions
CI/CD with Github ActionsCI/CD with Github Actions
CI/CD with Github Actions
 
CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
 
API Management Part 1 - An Introduction to Azure API Management
API Management Part 1 - An Introduction to Azure API ManagementAPI Management Part 1 - An Introduction to Azure API Management
API Management Part 1 - An Introduction to Azure API Management
 
Automating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous IntegrationAutomating Deployment Between Orgs Using Git & Continuous Integration
Automating Deployment Between Orgs Using Git & Continuous Integration
 
A Definition of Done for DevSecOps
A Definition of Done for DevSecOpsA Definition of Done for DevSecOps
A Definition of Done for DevSecOps
 
Microservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito PactMicroservices Testing Strategies JUnit Cucumber Mockito Pact
Microservices Testing Strategies JUnit Cucumber Mockito Pact
 
Apigee Demo: API Platform Overview
Apigee Demo: API Platform OverviewApigee Demo: API Platform Overview
Apigee Demo: API Platform Overview
 
GitLab for CI/CD process
GitLab for CI/CD processGitLab for CI/CD process
GitLab for CI/CD process
 

Similar to Intro to React Native Testing Library

Designing Effective Tests with React Testing Library - React Summit 2023
Designing Effective Tests with React Testing Library - React Summit 2023Designing Effective Tests with React Testing Library - React Summit 2023
Designing Effective Tests with React Testing Library - React Summit 2023Josh Justice
 
Testing React Native Apps - Chain React 2023
Testing React Native Apps - Chain React 2023Testing React Native Apps - Chain React 2023
Testing React Native Apps - Chain React 2023Josh Justice
 
Effective Detox Testing - React Advanced 2023
Effective Detox Testing - React Advanced 2023Effective Detox Testing - React Advanced 2023
Effective Detox Testing - React Advanced 2023Josh Justice
 
Building for Mobile and Web with Expo - React Advanced London 2022
Building for Mobile and Web with Expo - React Advanced London 2022Building for Mobile and Web with Expo - React Advanced London 2022
Building for Mobile and Web with Expo - React Advanced London 2022Josh Justice
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"LogeekNightUkraine
 
Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Viktor Turskyi
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorCubet Techno Labs
 
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15GreeceJS
 
Putting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native BostonPutting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native Bostonstan229
 
Cleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsCleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsDebora Gomez Bertoli
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKJosé Paumard
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitAriya Hidayat
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Josh Juneau
 
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Steffen Gebert
 
Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondRamon Ribeiro Rabello
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Roberto Franchini
 
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEF
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEFDEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEF
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEFFelipe Prado
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftChris Bailey
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with ReactjsThinh VoXuan
 

Similar to Intro to React Native Testing Library (20)

Designing Effective Tests with React Testing Library - React Summit 2023
Designing Effective Tests with React Testing Library - React Summit 2023Designing Effective Tests with React Testing Library - React Summit 2023
Designing Effective Tests with React Testing Library - React Summit 2023
 
Testing React Native Apps - Chain React 2023
Testing React Native Apps - Chain React 2023Testing React Native Apps - Chain React 2023
Testing React Native Apps - Chain React 2023
 
Effective Detox Testing - React Advanced 2023
Effective Detox Testing - React Advanced 2023Effective Detox Testing - React Advanced 2023
Effective Detox Testing - React Advanced 2023
 
Building for Mobile and Web with Expo - React Advanced London 2022
Building for Mobile and Web with Expo - React Advanced London 2022Building for Mobile and Web with Expo - React Advanced London 2022
Building for Mobile and Web with Expo - React Advanced London 2022
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
 
Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)Yet another json rpc library (mole rpc)
Yet another json rpc library (mole rpc)
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
 
Putting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native BostonPutting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native Boston
 
Cleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsCleaning your architecture with android architecture components
Cleaning your architecture with android architecture components
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Hybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKitHybrid Apps (Native + Web) via QtWebKit
Hybrid Apps (Native + Web) via QtWebKit
 
React custom renderers
React custom renderersReact custom renderers
React custom renderers
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
 
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
 
Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyond
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEF
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEFDEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEF
DEF CON 23 - Xntrik - hooked browser meshed networks with webRTC and BeEF
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with Reactjs
 

More from Josh Justice

Designing Effective Tests with React Testing Library - React Day Berlin 2022
Designing Effective Tests with React Testing Library - React Day Berlin 2022Designing Effective Tests with React Testing Library - React Day Berlin 2022
Designing Effective Tests with React Testing Library - React Day Berlin 2022Josh Justice
 
Building for Mobile and Web with Expo - React Day Berlin 2022
Building for Mobile and Web with Expo - React Day Berlin 2022Building for Mobile and Web with Expo - React Day Berlin 2022
Building for Mobile and Web with Expo - React Day Berlin 2022Josh Justice
 
Getting Better All the Time: How to Escape Bad Code
Getting Better All the Time: How to Escape Bad CodeGetting Better All the Time: How to Escape Bad Code
Getting Better All the Time: How to Escape Bad CodeJosh Justice
 
Sustainable Learning - ReactATL Jan 2022
Sustainable Learning - ReactATL Jan 2022Sustainable Learning - ReactATL Jan 2022
Sustainable Learning - ReactATL Jan 2022Josh Justice
 
Building an App for Mobile and Web with Expo
Building an App for Mobile and Web with ExpoBuilding an App for Mobile and Web with Expo
Building an App for Mobile and Web with ExpoJosh Justice
 
User-Modifiable Software: Smalltalk and HyperCard
User-Modifiable Software: Smalltalk and HyperCardUser-Modifiable Software: Smalltalk and HyperCard
User-Modifiable Software: Smalltalk and HyperCardJosh Justice
 
Practical Accessibility (A11y)
Practical Accessibility (A11y)Practical Accessibility (A11y)
Practical Accessibility (A11y)Josh Justice
 
Old Solutions to New Testing Problems
Old Solutions to New Testing ProblemsOld Solutions to New Testing Problems
Old Solutions to New Testing ProblemsJosh Justice
 
Test-Driven Development in Vue with Cypress
Test-Driven Development in Vue with CypressTest-Driven Development in Vue with Cypress
Test-Driven Development in Vue with CypressJosh Justice
 
Test-Driven Development in React with Cypress
Test-Driven Development in React with CypressTest-Driven Development in React with Cypress
Test-Driven Development in React with CypressJosh Justice
 
Newbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelNewbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelJosh Justice
 
Outside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressOutside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressJosh Justice
 

More from Josh Justice (12)

Designing Effective Tests with React Testing Library - React Day Berlin 2022
Designing Effective Tests with React Testing Library - React Day Berlin 2022Designing Effective Tests with React Testing Library - React Day Berlin 2022
Designing Effective Tests with React Testing Library - React Day Berlin 2022
 
Building for Mobile and Web with Expo - React Day Berlin 2022
Building for Mobile and Web with Expo - React Day Berlin 2022Building for Mobile and Web with Expo - React Day Berlin 2022
Building for Mobile and Web with Expo - React Day Berlin 2022
 
Getting Better All the Time: How to Escape Bad Code
Getting Better All the Time: How to Escape Bad CodeGetting Better All the Time: How to Escape Bad Code
Getting Better All the Time: How to Escape Bad Code
 
Sustainable Learning - ReactATL Jan 2022
Sustainable Learning - ReactATL Jan 2022Sustainable Learning - ReactATL Jan 2022
Sustainable Learning - ReactATL Jan 2022
 
Building an App for Mobile and Web with Expo
Building an App for Mobile and Web with ExpoBuilding an App for Mobile and Web with Expo
Building an App for Mobile and Web with Expo
 
User-Modifiable Software: Smalltalk and HyperCard
User-Modifiable Software: Smalltalk and HyperCardUser-Modifiable Software: Smalltalk and HyperCard
User-Modifiable Software: Smalltalk and HyperCard
 
Practical Accessibility (A11y)
Practical Accessibility (A11y)Practical Accessibility (A11y)
Practical Accessibility (A11y)
 
Old Solutions to New Testing Problems
Old Solutions to New Testing ProblemsOld Solutions to New Testing Problems
Old Solutions to New Testing Problems
 
Test-Driven Development in Vue with Cypress
Test-Driven Development in Vue with CypressTest-Driven Development in Vue with Cypress
Test-Driven Development in Vue with Cypress
 
Test-Driven Development in React with Cypress
Test-Driven Development in React with CypressTest-Driven Development in React with Cypress
Test-Driven Development in React with Cypress
 
Newbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to BabelNewbie's Guide to Contributing to Babel
Newbie's Guide to Contributing to Babel
 
Outside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressOutside-in Testing in Vue with Cypress
Outside-in Testing in Vue with Cypress
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Intro to React Native Testing Library

  • 1. Intro to React Native Testing Library While we're waiting to start, if you're comfortable, share your answer to the following question in the chat: What do you want to learn about testing in this workshop? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 2. Intro to React Native Testing Library https://rnte.st/london22 Clone the repo, build, and test! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 3. Josh Justice CodingItWrong.com Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 4. ReactNativeTesting.io Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 5. Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 6. What We'll Cover — React Native Testing Library — Jest Native Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 7. What We Won't Cover — Jest basics — End-to-end testing (Detox, Appium) Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 8. Learning More Afterward — https://rnte.st/london22 — Discord community Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 9. 02 Component Tests: Rendering Intro to React Native Testing Library Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 10. What is a component test? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 11. React Native Testing Library @testing-library/react-native callstack.github.io/react-native-testing-library Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 12. What to test? — Call methods/functions? — Check state values? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 13. "We don’t encourage reading implementation details like state variables themselves…Instead, test observable behavior — i.e. what your component renders or does." -- @dan_abramov, 2019-03-06 tweet Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 14. Testing the Contract Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 15. "A component contract is the agreement between a component and the rest of the application." -- Edd Yerburgh, Testing Vue.js Applications Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 16. "Other components can assume the component will fulfill its contractual agreement and produce the agreed output if it’s provided the correct input." -- Edd Yerburgh, Testing Vue.js Applications Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 17. Question: what are some of the kinds of inputs and outputs that components have? Answer in the chat! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 18. Testing the Contract Inputs: — Props — User interaction events Outputs: — Rendered UI — Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 19. Testing the Contract Inputs: — Props — User interaction events Outputs: — Rendered UI — Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 20. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 21. Getter Functions — screen.getByText — screen.getByLabelText — screen.getByPlaceholder Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 22. Text return <Text>Hello, world!</Text>; screen.getByText('Hello, world!') Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 23. TextInput return <TextInput placeholder="Enter your name" ... />; screen.getByPlaceholderText('Enter your name') Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 24. Image return ( <Image source={...} accessibilityLabel="squirrel waving" /> ); screen.getByLabelText('squirrel waving') Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 25. SVG import WavingHand from './assets/waving-hand.svg'; return <WavingHand accessibilityLabel="waving hand" />; screen.getByLabelText('waving hand') Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 26. Query Functions — screen.queryByText — screen.queryByLabelText — screen.queryByPlaceholder Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 27. Which Query Should I Use? https://callstack.github.io/react-native-testing-library/docs/how-should-i-query "your test should resemble how users interact with your code (component, page, etc.) as much as possible" Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 28. Which Query Should I Use? https://callstack.github.io/react-native-testing-library/docs/how-should-i-query Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 29. Note on getByRole() screen.getByRole('button', {name: 'Save Changes'}) — Likely going to be the top recommendation soon — Feature needed first: implicit roles (Pressables queryable as button by default) Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 30. Confirming Presence expect(screen.getBy…()).toBeVisible(); As of jest-native 5.1 Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 31. Confirming Presence -Alternatives expect(screen.getBy…()).toBeTruthy(); expect(screen.queryBy…()).toBeTruthy(); screen.getBy…(); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 32. Confirming Presence expect(screen.getBy…()).toBeVisible(); ✅ Gives best error message ✅ Looks like an expectation ✅ Does extra visibility checking for realism Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 33. Confirming Absence expect(screen.queryBy…()).toBeNull(); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 34. Testing the Contract Inputs: — Props — User interaction events Outputs: — Rendered UI — Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 35. Testing the Contract Inputs: — Props — User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 36. Testing the Contract Inputs: — Props — User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 37. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 38. Testing the Contract Inputs: — Props — User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 39. Testing the Contract Inputs: ✅ Props - User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 40. Exercise 1 — intro-to-rntl-exercises — exercises/1-Exercise1.md For help: reactnativetesting.io/component/testing/ Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 41. A few more notes about testing rendering and props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 42. Testing content, not appearance. Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 43. What about snapshot tests? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 44. import renderer from 'react-test-renderer'; import Hello from './Hello'; it('renders correctly', () => { const tree = renderer.create(<Hello name="Josh" />).toJSON(); expect(tree).toMatchSnapshot(); }); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 45. 03 Component Tests: Actions and Mocks Intro to React Native Testing Library Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 46. Testing the Contract Inputs: ✅ Props - User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 47. Testing the Contract Inputs: ✅ Props - User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 48. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 49. import {render, fireEvent} from '@testing-library/react-native'; describe('NewMessageForm', () => { describe('pressing send', () => { it('clears the message field', () => { render(<NewMessageForm />); fireEvent.changeText( screen.getByPlaceholderText('Message'), 'Hello world', ); fireEvent.press(screen.getByText('Send')); expect(screen.getByPlaceholderText('Message')).toHaveProp('value', ''); }); }); }); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 50. fireEvent import {fireEvent} from '@testing-library/react-native'; fireEvent.press(element) fireEvent.changeText(element, text) fireEvent.scroll(element, eventData) fireEvent(element, eventName, eventData) Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 51. import {render, fireEvent} from '@testing-library/react-native'; describe('NewMessageForm', () => { describe('pressing send', () => { it('clears the message field', () => { render(<NewMessageForm />); fireEvent.changeText( screen.getByPlaceholderText('Message'), 'Hello world', ); fireEvent.press(screen.getByText('Send')); expect(screen.getByPlaceholderText('Message')).toHaveProp('value', ''); }); }); }); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 52. toHaveProp Provided by Jest Native expect(...).toHaveProp('propName', 'propValue'); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 53. Testing the Contract Inputs: ✅ Props - User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 54. Testing the Contract Inputs: ✅ Props ✅ User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 55. Testing the Contract Inputs: ✅ Props ✅ User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 56. Mock Functions jestjs.io/docs/mock-functions Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 57. Creating a New Mock Function const myMockFunction = jest.fn().mockName('myMockFunction'); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 58. Mock Matchers expect(myMock).toHaveBeenCalled(); expect(myMock).toHaveBeenCalledWith(param, otherParam, ...); expect(myMock).toHaveBeenCalledWith(expect.any(String)); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 59. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 60. it('calls the send handler', () => { const messageText = 'Hello world'; const sendHandler = jest.fn().mockName('sendHandler'); render(<NewMessageForm onSend={sendHandler} />); fireEvent.changeText( screen.getByPlaceholderText('Message'), messageText, ); fireEvent.press(screen.getByText('Send')); expect(sendHandler).toHaveBeenCalledWith(messageText); }); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 61. Are mocks Testing implementation details? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 62. No, mocks are an essential part of Testing the contract. Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 63. Testing the Contract Inputs: ✅ Props ✅ User interaction events Outputs: ✅ Rendered UI - Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 64. Testing the Contract Inputs: ✅ Props ✅ User interaction events Outputs: ✅ Rendered UI ✅ Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 65. Exercise 2 — intro-to-rntl-exercises — exercises/2-Exercise2.md For help: reactnativetesting.io/component/testing/#interaction Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 66. Testing the Contract Inputs: — Props — User interaction events Outputs: — Rendered UI — Calls to function props Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 67. 04 Component Tests: Effects and Module Mocks Intro to React Native Testing Library Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 68. How can we test effects? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 69. How can we test effects? Test the effect/result. Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 70. Data loading effects hit the API Problem? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 71. Options for Mocking Web Service Requests Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 72. Options for Mocking Web Service Requests Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 73. Jest Module Mocks jestjs.io/docs/mock-functions#mocking-modules Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 74. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 75. import {render, screen} from '@testing-library/react-native'; import WidgetContainer from './WidgetContainer'; import api from './api'; jest.mock('./api'); describe('WidgetContainer', () => { it('loads widgets upon first render', async () => { api.get.mockResolvedValue({/* the response object */}); render(<WidgetContainer />); await screen.findByText('Widget 1')); expect(screen.getByText('Widget 2')).toBeVisible(); expect(api.get).toHaveBeenCalledWith('/widgets'); }); }); Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 77. Getter Functions — screen.getByText — screen.getByLabelText — screen.getByPlaceholder Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 78. Find Functions — screen.findByText — screen.findByLabelText — screen.findByPlaceholder Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 79. Exercise 3 — intro-to-rntl-exercises — exercises/3-Exercise3.md For help: reactnativetesting.io/component/testing.html Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 80. act() Error Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 81. To the code! Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 82. 05 Wrap-up Intro to React Native Testing Library Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 83. What did we learn? — What does it mean to test the contract? — Why test the contract? — What are the inputs and outputs of a component? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 84. Remaining Questions? Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 85. Continuing the Learning — https://rnte.st/london22 — Discord community Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 86. Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22
  • 87. Thanks! Josh Justice josh.justice@testdouble.com https://rnte.st/london22 Introduction to React Native Testing Library - Josh Justice - React Advanced London - 2022-10-28 - https://rnte.st/london22