Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

OS 7.1 (3 of 4): Front-end testing

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

40 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Fine on my laptop

A student builds a bus times page. On the laptop it looks great.

Then a friend opens it on a phone. The text is tiny. One box is cut off. The page takes ten seconds to load.

The code was correct. The page still failed its users. Front-end testing finds this.

Key words

WordWhat it meansExample
Front-endThe part of a product the user sees and touches.A web page
BrowserThe program that opens web pages.Chrome, Firefox, Safari
RenderingHow the browser draws the page on the screen.Fonts, colours, layout
ResponsiveChanging to fit the size of the screen.One column on a phone
Loading timeHow long the page takes to appear.3 seconds
ScriptCode that runs inside the page.JavaScript for a button that adds to a basket
Operating systemThe main software on a device.Windows, macOS, Android, iOS
Cross-browserWorking the same in more than one browser.Same page in Chrome and Safari
KB (kilobyte)A unit for the size of a file.A small picture is about 50 KB
Media queryA CSS rule that works only on some screen sizes.@media (max-width: 500px)

The cells students fill in are left blank in this preview.

Front-end testing makes seven checks

CheckThe questionA way to test it
Script performance and functionalityDo the buttons and forms work? Are they fast?Click everything. Watch the browser console for errors
Browser compatibilityDoes it work in each browser we support?Open it in Chrome, Firefox, Safari and Edge
Operating system compatibilityDoes it work on each system?Try Windows, macOS, Android and iOS
Cross-browser performanceIs it equally fast in every browser?Time the same action in each browser
Formatting and renderingDoes it look right?Check fonts, colours, images and spacing
Loading timesDoes it appear quickly?Use the browser developer tools to time it
ResponsivenessDoes it fit every screen size?Resize the window. Use the device mode in developer tools

The cells students fill in are left blank in this preview.

Match each symptom to its check

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

A responsive page fits every screen

People use phones, tablets and big screens. A responsive page changes to fit.

To test it, make the window narrow and look. In the browser, press F12 for the developer tools. Then use the device mode to see a phone size.

Try it: narrow the window

Code: web
<h1>Bus times</h1>
<div class="box">Route 42</div>
<div class="box">Route 5A</div>

Make a free account to save your work and track your progress.

A page that looks fine can be broken

Tip

Many people think a page that looks right also works. A page can look fine and still have a broken script. Press F12 and open the Console tab. A red message there is a script error. Test every button, then check the console.

Fix the page for a phone

This bus times page is fixed at 900 pixels wide. On a phone you must scroll sideways. 1. Change the CSS so the three boxes fit any screen. Use a width in % (percent, such as 30%) or a media query. 2. Make the window narrow to test it. On a phone size, the boxes should sit one under another or fit side by side. 3. Ask your teacher to look at your page.

Code: web
<h1>Bus times</h1>
<div class="row">
  <div class="box">Route 42</div>
  <div class="box">Route 5A</div>
  <div class="box">Route 17</div>
</div>
<p>Next bus in 4 minutes.</p>

Make a free account to save your work, or press Start lab to work through the whole lesson.

Loading time is size divided by speed

A page is made of files: text, pictures and scripts. A big picture can slow the whole page.

You can work out the time. Time in seconds is the size divided by the speed. Sizes here are in KB.

Worked example: loading time

StepWhat we doNumber
1Find the page size2000 KB
2Find the phone download speed500 KB every second
3Divide the size by the speed: 2000 divided by 5004 seconds
4Our limit is 3 seconds, so the page isToo slow

The cells students fill in are left blank in this preview.

Smaller pictures load faster

Tip

The biggest file is often a picture. Make the picture file smaller and the page loads much faster.

Your turn: loading time

A page loads files of different sizes. Fill in three functions. loading_time divides the size by the speed. too_slow says if the time is over the limit. heaviest_file gives the name of the biggest file in a dictionary. Press Run Tests.

Code: python
# A web page is made of files. Every size is in kilobytes (KB).
# Speed is how many KB a phone can download in one second.

def loading_time(size_kb, speed_kb_per_second):
    # Seconds to download = size divided by speed.
    return 0


def too_slow(size_kb, speed_kb_per_second, limit_seconds):
    # True if the page takes longer than the limit.
    return False


def heaviest_file(files):
    # files is a dictionary: name -> size in KB. Give back the name of the biggest file.
    return ""

Make a free account to save your work, or press Start lab to work through the whole lesson.

Key words crossword

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Final check

Have a go

Final check

6 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.