aboutsummaryrefslogtreecommitdiff
path: root/tests/mobly/base_test_test.py
AgeCommit message (Collapse)Author
2023-12-28Add parent field to records to represent repeat and retry information. (#905)boon
This provides a generic way to mark the sequential relationship of test result records. The intention is to make it easier for downstream parsers to process test result records for repeat and retry cases. The `retry_parent` field is now deprecated in test result record.
2023-10-26Fix current formatting issues and add formatting check to CI workflow (#902)nkprasad12
* Switch to Pyink for formatting --------- Co-authored-by: Nitin Prasad <nkprasad@google.com>
2023-04-25Properly end the test when expects has an error within teardown test. (#882)boon
2023-01-13 Ensure the termination of the `teardown_class` record. (#864)Ang Li
2022-12-06Don't mutate BaseTestClass.record_data() argument. (#856)Jon Wolverton
2022-08-02Fix calling `generate_tests` in the `setup_genearted_tests` stage. (#847)Ang Li
Although it is deprecated, we need to keep it working until the complete removal.
2022-08-01Rename the `setup_generated_tests` stage to `pre_run`. (#844)Ang Li
Users have identified more legit use cases where operations before `setup_class` are needed. The `setup_generated_tests` stage is essentially the stage before `setup_class`. Hence we are renaming it more properly.
2021-12-27Add basic `retry()` and `repeat()` support to generated tests. (#766)PCMan
When generating tests, if the `test_logic` function is decorated with either `retry()` or `repeat()` decorators, apply the settings to the generated test methods.
2021-12-23Replace mock with unittest.mock and cleanup import section. (#785)Eric Lin (Tzu Hsiang Lin)
1. unittest.mock is added in Python 3.3, Mobly works on 3.6+ so we can replace mock with unittest.mock 2. Fix bad import order according to Google Python style guide: https://google.github.io/styleguide/pyguide.html#313-imports-formatting 3. Cleanup unused import 4. Remove `from builtins import str`
2021-08-22Inspect class instead of class instance to get test methods list. (#762)xianyuanjia
2021-06-09Test run exit status should be `0` if test retry eventually passed. (#755)Ang Li
2021-05-05Add support for `max_consecutive_error` in `repeat`. (#740)Ang Li
2021-04-23Support native repeat and retry in Mobly. (#734)Ang Li
* Provides decorators for users to mark test cases for repeat and retry. * Adds new attributes to the TestResultRecord for associating retry test records. * Refactors existing code to support the repeat/retry behavior.
2021-02-15Drop the py2 compatibility in class declaration statements. (#724)Eric Lin (Tzu Hsiang Lin)
In Python 3, only new-style classes exist. No need to inherit from class object. Reference: https://stackoverflow.com/questions/4015417/python-class-inherits-object
2021-02-15Drop the py2 compatibility in unittest usages. (#726)Eric Lin (Tzu Hsiang Lin)
2021-02-12Drop the py2 compatibility in super() statements. (#722)Eric Lin (Tzu Hsiang Lin)
In code that must support python2,  super must be called as super(MyClass, self), but in python3-only code this is unnecessary and not recommended.
2021-01-22Fix some usages of asserts in tests. (#714)Ang Li
2021-01-20Re-format all codes to Google style. (#713)Ang Li
* Add a config file for yapf * Clarify the pre-submit steps in CONTRIBUTION.
2021-01-13Move to 2-space indent: test files except AndroidDevice related (#710)Eric Lin (Tzu Hsiang Lin)
Pure shortening of the indentation length, no actual code change.
2019-10-23Log path changes in `BaseTestClass`. (#650)Ang Li
* Add a new level of output directoy specific to test classes. * Direct `log_path` to class-specific. * Add a `root_output_path` pointing to the test run path (what `log_path` used to point to)
2019-10-20Change test case filter to use callable() instead of inspect.ismethod() (#648)xianyuanjia
2019-10-11Guarantees the test stage end message is always logged. (#639)Mark De Ruyter
Without this try/finally statement, a raised error within the context causes the ending log line to not be logged.
2019-10-07Remove long deprecated APIs. (#640)Ang Li
2019-07-09Fix typos. (#595)winterfroststrom
2019-05-22Fix yaml load usage warnings. (#578)Ang Li
2019-03-12Add support for specifying UID for test cases (#571)Ang Li
2018-10-22Introduce a proper execution stage for final clean up. (#538)Ang Li
2018-10-15Fix `expects` for different test stages. (#531)Ang Li
Also fix a bug where setup_class record is not written to file correctly.
2018-10-04Fix pytest init warnings. (#521)winterfroststrom
2018-09-18Create a proper manager for controllers. (#497)Ang Li
Moving existing controller management logic to a dedicated manager class. This improves code quality and reduces maintain cost. Base class uses calls APIs in the new controller manager instead of holding all the controller states itself directly.
2018-09-13Fix racing conditions in unit tests. (#496)Ang Li
2018-09-12Properly record controller info. (#495)Ang Li
* Support multiple groups of controller info in test result record. * Record controller info at the end instead of the beginning of a test class run. * Introduce a proper data class for controller info. * Add the new module needed for the new unit tests.
2018-08-29Move `register_controller` into `base_test`. (#493)Ang Li
So the controller objects of a class is encapsulatd within the test class itself. This makes the structure cleaner and gets rid of the awkward passing of a partial function from test runner to each test class.
2018-07-24Improve boundary clarity of execution stages in logs (#478)Ang Li
* Clarify each execution stage in DEBUG log. * Fix behavior for `setup_generated_test` failure and add a unit test for it.
2018-06-21Use io.open to set file encoding (#465)winterfroststrom
2018-06-19Add unit test for `on_fail` and `setup_class` both raising errors. (#464)Ang Li
* Also fix a problem where `_` prefix is exposed in error record.
2018-06-12Fix behaviors of `abort_all` in procedural functions. (#461)Ang Li
* `abort_all` should skip remaining tests in a class just like `abort_class`. * A record for `setup_class` should exist if `setup_class` failed and `abort_all` is called in `on_fail` * Handle the case of calling `abort_all` in `teardown_class`.
2018-05-11Extend runtime test info for `setup_class` stage. (#444)Ang Li
So `BaseTestClass.current_test_info` can be used more consistently throughout the test class.
2018-04-06APIs to add additional blocks in test summary file (#376)Ang Li
* Support adding arbitrary info in test summary.
2018-04-02Fixed missing stacktrace for py2 for setup_test failure (#413)Matthew
* Fixed missing stacktrace for py2 for setup_test failure
2018-02-16Handle calling `asserts.abort_all` in `on_fail` (#408)Ang Li
2018-01-31Set `end_time` when `teardown_test` fails. (#393)Ang Li
2017-10-20Delayed termination support (Expect) (#344)Ang Li
* Add new module `mobly.expects` with expectation APIs. * Modify base_test to utilize the new module.
2017-10-09Expose more test runtime info. (#330)Ang Li
Add a `RuntimeTestInfo` type to expose more runtime info of the test. This way we don't have to keep adding more attributes to base class.
2017-08-29Fix abort class in `setup_test` and procedure functions. (#323)Ang Li
Add a base type for both abort signals.
2017-08-16Fix tallying for FAIL from `setup_test` (#311)Ang Li
* If `setup_test` fails with TestFailure, it should be tallied with ERROR status. * Add a test case for skipping in setup_test.
2017-08-15Properly report errors in teardown_class. (#306)Ang Li
2017-08-11Properly record extra errors. (#284)Ang Li
* Include exception objects in record for tests' procedure functions to consume * Introduce a wrapper class for storing exception objects in record, including info like stacktrace. * Introduce an alias for the main exception. * Mark failed tests as fail despite subsequent errors..
2017-08-08Pass test record to procedure on_xxxx functions. (#293)Ang Li
Instead of arbitrary fields, now pass all the info of the test execution so procedure functions can be more useful.
2017-08-08Fix a bug where timestamps are set on tests that didn't even start. (#269)Ang Li
* Fix a bug where timestamps are set on tests that didn't even start. * More unit test conditions for when test is skipped from within.