Development, testing and production environments

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Development, testing and production environments

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which environment is where developers write and change code?
A Production
B Development
2. Which environment is used to check that the software works and is secure before release?
A Testing
B Development
3. Which environment holds real users and live data?
A Production
B Testing
4. What kind of data should be used in the testing environment?
A Made-up test data that contains no real personal details
B A copy of real customer records so the tests are realistic
5. Which describes the correct order that code is promoted through?
A Development, then production, then testing
B Development, then testing, then production

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1ENV = "development" AThe testing environment is connected to live data. Testing should use fake test data so real customer information is not exposed if something goes wrong.
2ENV = "production" Bdb = "test_db" # fake customer data
3The testing environment checks that the software works and is secure using fake test data, not real customer records CUntested code is pushed straight into production, skipping the development and testing environments.
4Code is promoted from one environment to the next only after it has passed the checks at the current stage DThe environment where developers write and change code, using test data so nothing real is put at risk
5# Testing environment db = "live_customer_db" EThe live environment where real users run the software and real data is stored and processed
6# Developer edits code directly deploy("production", untested_code) Fif tests_passed: deploy("production")

Definitions

development, testing and production

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# Developers write and change code here environment = "___________"
2.
if environment __ "testing": runTests()
3.
# Real users and live data use this stage environment = "__________"
4.
environment = "production" data = "____"
5.
# Code is moved on to be checked promote(code, "development", "_______")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A ENV ← 'testing'
B DB ← 'live_data.db'
C IF ENV = 'testing' THEN
D connect(DB)
E END IF
Question 2
A write(code, 'development')
B check(code, 'testing')
C release(code, 'development')
Question 3
A env ← 'production'
B data ← load_test_data()
C show_to_users(data)
Question 4
A IF env = 'development' THEN
B debug ← FALSE
C ELSE
D debug ← FALSE
E END IF
Question 5
A deploy(build, 'testing')
B results ← run_tests(build)
C IF results = 'pass' THEN
D deploy(build, 'development')
E END IF

Answer Key

Development, testing and production environments
Section A: Quick Questions
Q1
B — Development
Q2
A — Testing
Q3
A — Production
Q4
A — Made-up test data that contains no real personal details
Q5
B — Development, then testing, then production
Section B: Match the Pairs
Q1
ENV = "development" → The environment where developers write and change code, using test data so nothing real is put at risk
Q2
ENV = "production" → The live environment where real users run the software and real data is stored and processed
Q3
The testing environment checks that the software works and is secure using fake test data, not real customer records → db = "test_db" # fake customer data
Q4
Code is promoted from one environment to the next only after it has passed the checks at the current stage → if tests_passed: deploy("production")
Q5
# Testing environment db = "live_customer_db" → The testing environment is connected to live data. Testing should use fake test data so real customer information is not exposed if something goes wrong.
Q6
# Developer edits code directly deploy("production", untested_code) → Untested code is pushed straight into production, skipping the development and testing environments.
Section C: Definitions
Q1
development, testing and production — The three environments software moves through: development is where code is written, testing is where it is checked with test data, and production is where real users use live data.
Section D: Fill in the Blanks
Q1
# Developers write and change code here environment = "development"
Q2
if environment == "testing": runTests()
Q3
# Real users and live data use this stage environment = "production"
Q4
environment = "production" data = "live"
Q5
# Code is moved on to be checked promote(code, "development", "testing")
Section E: Spot the Error
Q1
B — The testing environment must use test data, not live data. Line 2 should be DB ← 'test_data.db' so real user records are not put at risk.
Q2
C — Code is released to real users in the production environment. Line 3 should release to 'production', not back to 'development'.
Q3
B — Production is where real users work with live data. Line 2 should load live data with load_live_data(), because test data is only for testing.
Q4
B — Developers switch debugging on in the development environment so they can find faults while writing code. Line 2 should be debug ← TRUE, with debugging off in production.
Q5
D — Once the tests pass, the build is promoted to production. Line 4 should be deploy(build, 'production'), not back to development.