Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Use the following BibTeX entry to cite this work:
@INPROCEEDINGS{DVMB2023, author={Doorn, Niels and Vos, Tanja and Marín, Beatriz and Barendsen, Erik}, booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, year={2023}, volume={}, number={}, pages={269-280}, doi={10.1109/ICST57152.2023.00033} }
#file pytest_file_to_test_parser.py
import pytest
def some_function(x1, x2, x3):
"""
# This is a function that does nothing. We just want to able to write test
# cases with different types for it to test our test case parser.
"""
return "that's it!"
@pytest.mark.parametrize("testcase, i1, i2, i3, output",[
(1, {2,4.2,3,4,6.5,5}, [2,3,4], (3,4,5), "OK!"), # sets, lists, tuples and strings with double quotes
(2, [], set(), (), 'this'), # empty set/lists/tuples and strings with single quotes
(3, True, 4.5, (3,4), 'hoi'), # bool, float
(4, {5}, set(), "3.555", '3.67'),
(5, {4}, {4}, [2,2,3,4,3,5,4,3], "{2,4,7}"), # comments
(6, '', None, "", {2,4,7}), # empty string and None
])
def test_some_function(testcase, i1, i2, i3, output):
assert some_function(i1, i2, i3) == output,\
"case {0}".format(testcase)