Package: touca
Touca Python SDKInstallpipinstalltoucaWe support Python v3.7 and newer.Sneak PeakFor a more thorough guide of how to use Touca SDK for Python, refer to ourdocumentation website.Let us imagine that we want to test a software workflow that takes the username
of a student and provides basic information about them.deftest_find_student():alice=find_student("alice")assertalice.fullname=="Alice Anderson"assertalice.dob==date(2006,3,1)assertalice.gpa==3.9We can use unit testing in which we hard-code expected values for each input.
But real-world software is complex:We need a large number of test inputs to gain confidence that our software
works as expected.Describing the expected behavior of our software for each test input is
difficult.When we make intentional changes to the behavior of our software, updating our
expected values is cumbersome.Touca is effective in testing software workflows that need to handle a large
variety of inputs or whose expected behavior is difficult to hard-code.importtoucafromstudentsimportfind_student@touca.workflow(testcases=["alice","bob","charlie"])defstudents_test(username:str):student=find_student(username)touca.check("fullname",student.fullname)touca.check("dob",student.dob)touca.check("gpa",student.gpa)This is slightly different from a typical unit test:Touca tests do not use expected values.Touca tests do not hard-code input values.With Touca, we describe how we run our code under test for any given test case.
We can capture values of interesting variables and runtime of important
functions to describe the behavior and performance of our workflow for that test
case.Now if we make changes to our workflow under test, we can rerun this test and
let Touca automatically compare our captured data points against those of a
previous baseline version and report any difference in behavior or performance.DocumentationDocumentation Website: If you are new to Touca, this
is the best place to start.Python SDK API Reference:
Auto-generated source code documentation for Touca Python SDK with explanation
about individual API functions.Python Examples:
Sample Python projects that show how to use Touca in various real-world
use-cases.CommunityWe hang onDiscord. Come say hi! We love making new
friends. If you need help, have any questions, or like to contribute or provide
feedback, that's the best place to be.ContributingWe welcome all forms of contributions, from adding new features to improving
documentation and sharing feedback.Code of ConductContributing GuideGood First IssuesFAQShould I install Touca as a development dependency?Yes, unless you like to capture data-points that are not accessible through
your software's public API. Touca data capturing functions (e.g.touca.checkandtouca.scoped_timer) are no-op in production environments. They only work
when called from a@touca.workflowcontext.How is Touca making money?Touca is open-source software that you can self-host for free. Touca, Inc.
operatesTouca Cloud: a managed cloud instance of
Touca with additional enterprise-ready features. We have a free plan and
leverage usage-based pricing to charge for storage and service. Visit ourpricing pageto learn more.LicenseThis repository is released under the Apache-2.0 License. SeeLICENSE.