Web testing Image by C Watts What is web testing? Testing web - - PowerPoint PPT Presentation

web testing
SMART_READER_LITE
LIVE PREVIEW

Web testing Image by C Watts What is web testing? Testing web - - PowerPoint PPT Presentation

Web testing Image by C Watts What is web testing? Testing web applications Applications of which the client runs in a web browser In this lecture on web testing What to test How to test it What to test Back end Front end HTTP (server)


slide-1
SLIDE 1

Web testing

Image by C Watts

slide-2
SLIDE 2

What is web testing?

Testing web applications

Applications of which the client runs in a web browser

slide-3
SLIDE 3

In this lecture on web testing

What to test How to test it

slide-4
SLIDE 4

What to test

Back end (server) Front end (client)

HTTP

  • Security testing
  • Load testing
  • Functionality testing
  • End-to-end testing
  • Unit testing
  • Performance testing (anything

non-functional)

  • User acceptance testing
  • Automated user interface testing
  • A/B testing
  • Exploratory testing
  • Accessibility testing
slide-5
SLIDE 5

Tips

  • Carefully consider the aforementioned types of tests
  • Take all these tests into account when doing hour estimations
slide-6
SLIDE 6

The remainder of this lecture

JavaScript unit testing and UI component testing End-to-end testing Accessibility testing

slide-7
SLIDE 7

Introduction to JavaScript unit testing and UI component testing

slide-8
SLIDE 8

Technologies used

... but pick whatever you like best!

Enzyme

slide-9
SLIDE 9

Live coding: JavaScript unit tests

Pay attention to the following:

  • How does this compare to your Java unit tests?
  • How can you design your JavaScript for testability?

Image by Justin Henry

slide-10
SLIDE 10

Tips

  • Use a purely functional coding style
  • Separate logic from UI
  • Use modules to organise your code and to allow for easy mocking
slide-11
SLIDE 11

React components

Component

DOM representation

state

Document Object Model

props Example:

const TitleComponent = props => { return ( <h1>{props.title}</h1> ) };

JSX

slide-12
SLIDE 12

Live coding: React component tests

  • Compare this to “normal” unit tests of functions.
slide-13
SLIDE 13

Tips

  • Create small, independent components
  • Use component tests to do early UI testing
  • Snapshot tests can save you a lot of work, but use them with care
slide-14
SLIDE 14

End-to-end testing

slide-15
SLIDE 15

Story time: testing at QDelft

slide-16
SLIDE 16

Story time: testing at QDelft

# Description OK/NOK 1 Open the web application at http://localhost:3000 OK 2 Click the search box OK 3 Type some text in the search box and check whether the results list is updated automatically OK 4 Check whether the search results match the input NOK

Example of a manual “test script”:

slide-17
SLIDE 17

Automating end-to-end tests

Selenium

  • Works as a “remote control” for your browsers.
  • Can be used for automating any task (not just testing).
  • Useful for cross-browser testing (with services like BrowserStack).

Cypress

  • Integrates with your browser and is specifically targeted at end-to-

end testing.

slide-18
SLIDE 18

Demo: Cypress

slide-19
SLIDE 19

Challenges when doing end-to-end testing

  • Test data
  • Finding elements on the page
  • Waiting for results
slide-20
SLIDE 20

Accessibility testing

slide-21
SLIDE 21

Accessibility

Make sure that anyone can use your web application, including people with disabilities.

slide-22
SLIDE 22

Ishihara test

slide-23
SLIDE 23

Example: “your indicated availability”

When am I not available?

Mon Tue Wed Thu Fri 09:00-11:00

  • 11:00-13:00
  • 13:00-15:00
  • 15:00-17:00
slide-24
SLIDE 24

Example: “your indicated availability”

When am I not available?

Mon Tue Wed Thu Fri 09:00-11:00

  • 11:00-13:00
  • 13:00-15:00
  • 15:00-17:00
slide-25
SLIDE 25

Example: “your indicated availability”

Don’t do this

Mon Tue Wed Thu Fri

  • Instead do this

Mon Tue Wed Thu Fri ✓ ✓ ✓ ✓ ✓ ✓ ❌ ✓ ❌ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ❌ ✓ ❌ ✓

Success Criterion 1.4.1 Use of Color Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. — Web Content Accessibility Guidelines (WCAG) 2.1

slide-26
SLIDE 26

Web Content Accessibility Guidelines (WCAG)

Content should be:

  • Perceivable
  • Operable
  • Understandable
  • Robust

https://www.w3.org/TR/2018/REC-WCAG21-20180605/

slide-27
SLIDE 27

Accessibility: start early

If you only start thinking about accessibility during the testing phase, you are far too late. Start with inclusive design. Writing proper HTML prevents many accessibility issues.

slide-28
SLIDE 28

Accessibility tools

aXe WAVE Tenon

slide-29
SLIDE 29

Manual testing

Essential for accessibility testing (tools miss >30% of issues).

  • https://accessibility.blog.gov.uk/2017/02/24/what-we-found-when-we-

tested-tools-on-the-worlds-least-accessible-webpage/

User interaction, logical flow of the application.

slide-30
SLIDE 30

Thanks!

  • All the code is available at https://github.com/fm2003/emoji-search
slide-31
SLIDE 31

Web testing