LS 17 - Unit Testing

¡Supera tus tareas y exámenes ahora con Quizwiz!

You should write many individual tests that probe specific, individual use and edge cases rather than very few complex tests that probe many use/edge cases at the same time.

true

The word "unit" in "unit testing" refers to:

A unit of functionality

One benefit of unit testing is that once you have written your test functions it is less cumbersome to rerun multiple tests than testing manually in the REPL.

True

When using pytest, what convention must the names of the test functions inside the test file follow in order to be discovered as test cases?

begin with test_

Suppose your test functions are contained in a directory named lessons and a file named subjects_test.py. How would you run pytest from the terminal?

python -m pytest lessons/subjects_test.py

When using pytest, a popular unit testing framework, what convention must the file name of the file containing your test functions follow?

ends with _test

Suppose your test subject(s) (the function(s) you are working on) are contained in a directory named lessons and a file named subjects.py. Imagine the function you are working on is named example_function. How would you import the function into your tests file?

from lessons.subjects import example_function

One benefit of unit testing is that when a test fails the output is more helpful in showing you where exactly a test case is failing.

true

The assert keyword should be followed by a boolean expression. This expression should evaluate to True if the unit of functionality you are testing is working correctly, as expected.

true


Conjuntos de estudio relacionados

Chapter 62 Musculoskeletal Trauma and Orthopedic Surgery

View Set

10-2: Positioning the Unconscious Patient

View Set

Programming Logic and Design: Chapter 5

View Set

Life Insurance Exam: Nevada Laws and Ethics Pertinent to Insurance

View Set

Jason Dions Practice Exam 3 of 5

View Set