DOAIOT chap 5

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Based on the Python code for the function "calc_bmi()" below, which of the following PyTest assertions would Pass ?

def calc_bmi (bmi): if bmi < 18.5: return 0 elif bmi >= 18.5 and bmi < 30: return 1 else: return 2

  • assert (calc_bmi(30) == 1) (correct)
  • assert (calc_bmi(18.5) == 1)
  • assert (calc_bmi(18.5) == 0)
  • assert (calc_bmi(30.5) == 2)

Which of the following can Software Unit Tests be classified as ?

  • Black Box Tests
  • System Tests
  • Grey Box Tests
  • White Box Tests (correct)

Which of the following are possible benefits to developing Software Unit Test cases ?

  • It will improve the documentation of the code base
  • Unit Tests help to simplify the code
  • It helps to make the code more efficient and execute faster
  • Software Unit Test cases can be reused and executed again to validate of the code still functions correctly (correct)

In the PyTest framework, which constructs or functions are usually used to evaluate test conditions ?

<p>assert (B)</p>
Signup and view all the answers

Which of the following scenarios best describes a System Test for a "Drinks Vending Machine" project?

<p>Deposit $1.2 of coins and check that the LCD display correctly shows $1.20 after the coins have been deposited (D)</p>
Signup and view all the answers

In Python. which of the following is a commonly used Unit Testing framework?

<p>PyTest (A)</p>
Signup and view all the answers

Which of the following statements is correct?

<p>If all System Unit Test cases pass, it's not guaranteed that all System Test cases will pass (D)</p>
Signup and view all the answers

Which of the following is not a Software Unit Test tool?

<p>PIP (D)</p>
Signup and view all the answers

Flashcards

Software Unit Tests

Tests focused on small, isolated parts (units) of software code.

White Box Tests

Software tests that examine the internal structure and workings of a system.

PyTest assertions

Functions in PyTest used to check if conditions are true during testing.

System Test (Drinks Vending Machine)

Testing the complete system by simulating user interaction (e.g., inserting money, selecting drinks).

Signup and view all the flashcards

Python Unit Testing Framework

A tool for writing and running automated unit tests in Python.

Signup and view all the flashcards

System Unit Test Success vs. System Test Success

Passing all system unit tests doesn't guarantee passing all system tests. System unit tests are smaller parts, while system tests are the entire system working together.

Signup and view all the flashcards

calc_bmi Return Value (30)

The function calc_bmi() returns 2 if input bmi is more or equal to 30, 1 if input is in range 18,5 - 30 and 0 if input is less than 18,5.

Signup and view all the flashcards

Unit Test Tool (not PIP)

Tools specifically designed to perform and automate unit tests (e.g., PyTest); PIP is a package installer, not a testing tool.

Signup and view all the flashcards

More Like This

Use Quizgecko on...
Browser
Browser