Best Python code snippet using Testify_python
test_framework_instrumentation_categories.py
Source:test_framework_instrumentation_categories.py
1#2# Copyright (C) 2018 The Android Open Source Project3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15import logging16class TestFrameworkInstrumentationCategories(object):17 """Enum values for common category strings."""18 FRAMEWORK_SETUP = 'Framework setUp'19 FRAMEWORK_TEARDOWN = 'Framework tearDown'20 TEST_MODULE_SETUP = 'Test module setUp'21 TEST_MODULE_TEARDOWN = 'Test module tearDown'22 TEST_CLASS_SETUP = 'Test class setUp'23 TEST_CLASS_TEARDOWN = 'Test class tearDown'24 TEST_CASE_SETUP = 'Test case setUp'25 TEST_CASE_TEARDOWN = 'Test case tearDown'26 DEVICE_SETUP = 'Device setUp'27 DEVICE_CLEANUP = 'Device cleanUp'28 FAILED_TEST_CASE_PROCESSING = 'Failed test case processing'29 TEST_CASE_EXECUTION = 'Test case execution'30 RESULT_PROCESSING = 'Result processing'31 WAITING_FOR_DEVICE_RESPOND = 'Waiting for device respond'32 def Add(self, key, value):33 """Add a category key and value to the class attribute.34 Key being empty or starting with non-letter is not allowed.35 Returns:36 bool, whether adding the values is success37 """38 if not key or not key[0].isalpha():39 logging.error('Category name empty or starting with non-letter '40 'is not allowed. Ignoring key=[%s], value=[%s]',41 key, value)42 return False43 if hasattr(self, key):44 logging.warn('Categories key %s already exists with value %s. '45 'Overwriting with %s.', key, getattr(self,key), value)46 setattr(self, key, value)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!