Studentcould be defined as follows:
02_<lang>_main_apiexample which includes two modules
studentsmodule represents our code under test: the production code for our profile database software. Our code under test can have any complexity. It may call various nested functions, connect to database, and scrape the web to return information about a student given their username.
studentsmodule for a possible "current" implementation:
testcaseparameter to our Touca test workflow.
find_studentworkflow, we use
checkto track various characteristics of that output. Touca notifies us if these characteristics change in a future version of our
calculate_gpa. With Touca, we can check this function for regression by tracking both the calculated GPA and the list courses, without creating a separate test workflow.
checkinside our production code. Touca data capturing functions are no-op in the production environment. When they are executed by Touca workflow in a test environment, they start capturing values and associating them with the active test case.
stop_timerfor measuring runtime of a given piece of code, as shown below.
examplesrepository and create a virtual environment using Python v3.6 or newer.
examplesrepository and run
build.batdepending on your platform using CMake 3.14 or newer. This command produces executables in a
FetchContentto pull Touca SDK as a dependency. See our SDK documentation for instructions to use Conan, instead.
examplesrepository and use either of
npmto build examples using Node v12 or newer.
examplesrepository and use
gradleto build examples using Java 8 or newer.
--testcase-fileoption. Alternatively, we can add our test cases directly to the Touca server. When test cases are not provided via
--testcase-fileoptions, Touca SDKs attempt to retrieve them from the Touca server.