Base module for inherit new Test Suites
- class
qacode.core.testing.test_info.
TestInfoBase
[source]¶Bases:
object
Base class for inherit new Test classes
- classmethod
add_property
(name, value=None)[source]¶Add property to test instance using param ‘name’, will setup None if any value it’s passed by param
assert_contains_url
(actual, contains, msg=None, wait=0)[source]¶Allow to compare 2 urls and check if 1st contains 2nd url
assert_equals
(actual, expected, msg=None)[source]¶Allow to compare 2 values and check if 1st it’s equals to 2nd value
assert_equals_url
(actual, expected, msg=None, wait=0)[source]¶Allow to compare 2 urls and check if 1st it’s equals to 2nd url
- Arguments:
- actual {type} – actual value expected {type} – expected value
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
- Raises:
- AssertionError – [description]
assert_greater
(actual, greater, msg=None)[source]¶Allow to encapsulate method assertGreater(a, b, msg=msg)
assert_in
(actual, valid_values, msg=None)[source]¶Allow to compare if value it’s in to 2nd list of values
assert_is_instance
(instance, class_type, msg=None)[source]¶Allow to encapsulate method assertIsInstance(obj, cls, msg=’‘)
assert_lower
(actual, lower, msg=None)[source]¶Allow to encapsulate method assertLower(a, b, msg=msg)
- classmethod
assert_message
(assert_name, actual, expected, msg=None)[source]¶Generate assert message for method that calls for it
- Arguments:
- assert_name {str} – Assert method name that call actual {any} – Actual value to compare expected {any} – Expected value to compare
- Keyword Arguments:
- msg {[type]} – [description] (default: {None})
- Returns:
- str – Message to be use on Assert method
assert_not_contains_url
(actual, contains, msg=None, wait=0)[source]¶Allow to compare 2 urls and check if 1st not contains 2nd url
assert_not_equals
(actual, expected, msg=None)[source]¶Allow to compare 2 value to check if 1st isn’t equals to 2nd value
assert_not_equals_url
(actual, expected, msg=None, wait=0)[source]¶Allow to compare 2 urls to check if 1st isn’t equals to 2nd url
assert_not_in
(actual, invalid_values, msg=None)[source]¶Allow to compare if value it’s not in to 2nd list of values
assert_not_none
(actual, msg=None)[source]¶Allow to compare and check if value it’s not equals to ‘None’
assert_path_exist
(actual, is_dir=True, msg=None)[source]¶Allow to check if path exist, can check if is_dir also
assert_path_not_exist
(actual, msg=None)[source]¶Allow to check if path not exist, can check if is_dir also
assert_raises
(expected_exception, function, *args, **kwargs)[source]¶
- Allow to encapsulate pytest.raises method(
- *args=(
- expected_exception, function,
), **kwargs={
msg: ASSERT_MSG_DEFAULT}
)
assert_regex_url
(actual, pattern=None, msg=None)[source]¶Allow to compare if value match url pattern, can use custom pattern
- classmethod
bot_open
(config)[source]¶Open browser using BotBase instance
- Returns:
- BotBase – wrapper browser handler for selenium
- classmethod
cfg_app
(app_name)[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’ filtering by ‘app_name’ param
- classmethod
cfg_apps
()[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’
- classmethod
cfg_control
(control_name, page_name=None, app_name=None)[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’ filtering by ‘control_name’ param
- classmethod
cfg_controls
()[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’
- classmethod
cfg_page
(page_name, app_name=None)[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’ filtering by ‘page_name’ param
- classmethod
cfg_pages
()[source]¶Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’
config
= None¶
is_loaded
= False¶
log
= None¶
sleep
(wait=0)[source]¶Just call to native python time.sleep method
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
timer
(wait=5, print_each=5)[source]¶Timer to sleep browser on testcases
- Keyword Arguments:
wait {int} – seconds to wait (default: {5}) print_each {int} – print message each seconds, must be divisible
by 5, negatives are accepted (default: {5})- Raises:
- Exception – [description]
tlm
= None¶
- class
qacode.core.testing.test_info.
TestInfoBot
[source]¶Bases:
qacode.core.testing.test_info.TestInfoBase
Inherit class what implements bot on each testcase
bot
= None¶
- class
qacode.core.testing.test_info.
TestInfoBotUnique
[source]¶Bases:
qacode.core.testing.test_info.TestInfoBot
Inherit class what implements bot on each testcase
- class
qacode.core.testing.test_info.
TestInfoBase
[source]Base class for inherit new Test classes
- classmethod
add_property
(name, value=None)[source]Add property to test instance using param ‘name’, will setup None if any value it’s passed by param
assert_contains_url
(actual, contains, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st contains 2nd url
assert_equals
(actual, expected, msg=None)[source]Allow to compare 2 values and check if 1st it’s equals to 2nd value
assert_equals_url
(actual, expected, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st it’s equals to 2nd url
- Arguments:
- actual {type} – actual value expected {type} – expected value
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
- Raises:
- AssertionError – [description]
assert_false
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘False’
assert_greater
(actual, greater, msg=None)[source]Allow to encapsulate method assertGreater(a, b, msg=msg)
assert_in
(actual, valid_values, msg=None)[source]Allow to compare if value it’s in to 2nd list of values
assert_is_instance
(instance, class_type, msg=None)[source]Allow to encapsulate method assertIsInstance(obj, cls, msg=’‘)
assert_lower
(actual, lower, msg=None)[source]Allow to encapsulate method assertLower(a, b, msg=msg)
- classmethod
assert_message
(assert_name, actual, expected, msg=None)[source]Generate assert message for method that calls for it
- Arguments:
- assert_name {str} – Assert method name that call actual {any} – Actual value to compare expected {any} – Expected value to compare
- Keyword Arguments:
- msg {[type]} – [description] (default: {None})
- Returns:
- str – Message to be use on Assert method
assert_none
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘None’
assert_not_contains_url
(actual, contains, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st not contains 2nd url
assert_not_equals
(actual, expected, msg=None)[source]Allow to compare 2 value to check if 1st isn’t equals to 2nd value
assert_not_equals_url
(actual, expected, msg=None, wait=0)[source]Allow to compare 2 urls to check if 1st isn’t equals to 2nd url
assert_not_in
(actual, invalid_values, msg=None)[source]Allow to compare if value it’s not in to 2nd list of values
assert_not_none
(actual, msg=None)[source]Allow to compare and check if value it’s not equals to ‘None’
assert_not_regex
(actual, pattern, msg=None)[source]Allow to compare if value not match pattern
assert_path_exist
(actual, is_dir=True, msg=None)[source]Allow to check if path exist, can check if is_dir also
assert_path_not_exist
(actual, msg=None)[source]Allow to check if path not exist, can check if is_dir also
assert_raises
(expected_exception, function, *args, **kwargs)[source]
- Allow to encapsulate pytest.raises method(
- *args=(
- expected_exception, function,
), **kwargs={
msg: ASSERT_MSG_DEFAULT}
)
assert_regex
(actual, pattern, msg=None)[source]Allow to compare if value match pattern
assert_regex_url
(actual, pattern=None, msg=None)[source]Allow to compare if value match url pattern, can use custom pattern
assert_true
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘True’
- classmethod
bot_close
(bot)[source]Close bot calling bot.close() from param
- classmethod
bot_open
(config)[source]Open browser using BotBase instance
- Returns:
- BotBase – wrapper browser handler for selenium
- classmethod
cfg_app
(app_name)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’ filtering by ‘app_name’ param
- classmethod
cfg_apps
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’
- classmethod
cfg_control
(control_name, page_name=None, app_name=None)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’ filtering by ‘control_name’ param
- classmethod
cfg_controls
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’
- classmethod
cfg_page
(page_name, app_name=None)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’ filtering by ‘page_name’ param
- classmethod
cfg_pages
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’
- classmethod
load
(config)[source]Load default config dict
setup_method
(test_method, **kwargs)[source]Configure self.attribute
sleep
(wait=0)[source]Just call to native python time.sleep method
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
teardown_method
(test_method)[source]Unload self.attribute
timer
(wait=5, print_each=5)[source]Timer to sleep browser on testcases
- Keyword Arguments:
wait {int} – seconds to wait (default: {5}) print_each {int} – print message each seconds, must be divisible
by 5, negatives are accepted (default: {5})- Raises:
- Exception – [description]
Base module for inherit new Test Suites
- class
qacode.core.testing.test_info.
TestInfoBase
[source]Bases:
object
Base class for inherit new Test classes
- classmethod
add_property
(name, value=None)[source]Add property to test instance using param ‘name’, will setup None if any value it’s passed by param
assert_contains_url
(actual, contains, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st contains 2nd url
assert_equals
(actual, expected, msg=None)[source]Allow to compare 2 values and check if 1st it’s equals to 2nd value
assert_equals_url
(actual, expected, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st it’s equals to 2nd url
- Arguments:
- actual {type} – actual value expected {type} – expected value
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
- Raises:
- AssertionError – [description]
assert_false
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘False’
assert_greater
(actual, greater, msg=None)[source]Allow to encapsulate method assertGreater(a, b, msg=msg)
assert_in
(actual, valid_values, msg=None)[source]Allow to compare if value it’s in to 2nd list of values
assert_is_instance
(instance, class_type, msg=None)[source]Allow to encapsulate method assertIsInstance(obj, cls, msg=’‘)
assert_lower
(actual, lower, msg=None)[source]Allow to encapsulate method assertLower(a, b, msg=msg)
- classmethod
assert_message
(assert_name, actual, expected, msg=None)[source]Generate assert message for method that calls for it
- Arguments:
- assert_name {str} – Assert method name that call actual {any} – Actual value to compare expected {any} – Expected value to compare
- Keyword Arguments:
- msg {[type]} – [description] (default: {None})
- Returns:
- str – Message to be use on Assert method
assert_none
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘None’
assert_not_contains_url
(actual, contains, msg=None, wait=0)[source]Allow to compare 2 urls and check if 1st not contains 2nd url
assert_not_equals
(actual, expected, msg=None)[source]Allow to compare 2 value to check if 1st isn’t equals to 2nd value
assert_not_equals_url
(actual, expected, msg=None, wait=0)[source]Allow to compare 2 urls to check if 1st isn’t equals to 2nd url
assert_not_in
(actual, invalid_values, msg=None)[source]Allow to compare if value it’s not in to 2nd list of values
assert_not_none
(actual, msg=None)[source]Allow to compare and check if value it’s not equals to ‘None’
assert_not_regex
(actual, pattern, msg=None)[source]Allow to compare if value not match pattern
assert_path_exist
(actual, is_dir=True, msg=None)[source]Allow to check if path exist, can check if is_dir also
assert_path_not_exist
(actual, msg=None)[source]Allow to check if path not exist, can check if is_dir also
assert_raises
(expected_exception, function, *args, **kwargs)[source]
- Allow to encapsulate pytest.raises method(
- *args=(
- expected_exception, function,
), **kwargs={
msg: ASSERT_MSG_DEFAULT}
)
assert_regex
(actual, pattern, msg=None)[source]Allow to compare if value match pattern
assert_regex_url
(actual, pattern=None, msg=None)[source]Allow to compare if value match url pattern, can use custom pattern
assert_true
(actual, msg=None)[source]Allow to compare and check if value it’s equals to ‘True’
- classmethod
bot_close
(bot)[source]Close bot calling bot.close() from param
- classmethod
bot_open
(config)[source]Open browser using BotBase instance
- Returns:
- BotBase – wrapper browser handler for selenium
- classmethod
cfg_app
(app_name)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’ filtering by ‘app_name’ param
- classmethod
cfg_apps
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps’
- classmethod
cfg_control
(control_name, page_name=None, app_name=None)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’ filtering by ‘control_name’ param
- classmethod
cfg_controls
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages[j].controls’
- classmethod
cfg_page
(page_name, app_name=None)[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’ filtering by ‘page_name’ param
- classmethod
cfg_pages
()[source]Obtain inherit dict from ‘cls.config’ dict named ‘config.tests.apps[i].pages’
config
= None
is_loaded
= False
- classmethod
load
(config)[source]Load default config dict
log
= None
setup_method
(test_method, **kwargs)[source]Configure self.attribute
sleep
(wait=0)[source]Just call to native python time.sleep method
- Keyword Arguments:
- wait {int} – Wait time on Runtime execution before execute
- next lane of code (default: {0})
teardown_method
(test_method)[source]Unload self.attribute
timer
(wait=5, print_each=5)[source]Timer to sleep browser on testcases
- Keyword Arguments:
wait {int} – seconds to wait (default: {5}) print_each {int} – print message each seconds, must be divisible
by 5, negatives are accepted (default: {5})- Raises:
- Exception – [description]
tlm
= None
- class
qacode.core.testing.test_info.
TestInfoBot
[source]Bases:
qacode.core.testing.test_info.TestInfoBase
Inherit class what implements bot on each testcase
bot
= None
setup_method
(test_method, **kwargs)[source]Configure self.attribute. If skipIf mark applied and True as first param for args tuple
then not open bot
teardown_method
(test_method, close=True)[source]Unload self.attribute, also close bot
- class
qacode.core.testing.test_info.
TestInfoBotUnique
[source]Bases:
qacode.core.testing.test_info.TestInfoBot
Inherit class what implements bot on each testcase
- classmethod
setup_class
(**kwargs)[source]Configure ‘cls.attribute’. If name start with ‘test_’ and have decorator skipIf with value True, then not open bot
- classmethod
teardown_class
()[source]Unload self.attribute, closing bot from ‘cls.bot’ property
teardown_method
(test_method, close=False)[source]Unload self.attribute, also disable closing bot from TestInfoBot
- class
qacode.core.testing.test_info.
TestInfoBot
[source]Inherit class what implements bot on each testcase
setup_method
(test_method, **kwargs)[source]Configure self.attribute. If skipIf mark applied and True as first param for args tuple
then not open bot
teardown_method
(test_method, close=True)[source]Unload self.attribute, also close bot