Sorry for the trouble as I am completely new to behave.
what is "sb" ? Is it an object of some class that needs to eb instantiated in some fixture definition ?
Help appreciated.
You're probably looking for stackoverflow.com/a/41151454 , which explains pytest vs behave and has a link to pytest-bdd.
sb is the pytest fixture for SeleniumBase. Using SeleniumBase-as-a-fixture gives you the compatibility that you need to use pytest-bdd fixtures in your code at the same time, such as scenario, given, when, and then. Details on pytest-bdd can be found here: pypi.org/project/pytest-bdd/ . That is completely separate from SeleniumBase, but pytest does allow for the use of multiple fixtures at the same time.
Hi,
Sorry for the long post, I am trying to run sb without pytest. I found this code below from your examples.
1) Are all these settings mandatory ?
2)I am trying to use Allure reports, but its seems sb.pytest_html_report = "sb_report.html" is not generating any report , nor even logs in sb.log_path = "latest_logs/"
3) Eventually I want to create an object of sb and call from behave test steps, some how fixtures thing above didnt work for me . I want to create a SeleniumBase object in environment file before a feature starts running and use the same in test steps.
I have tried writing my own framework, but somehow I keep coming back to your work as I know I cant produce such a comprehensive and stable work ( Kudos!)
Hi,
1) When using a hack like github.com/seleniumbase/SeleniumBa... to avoid using pytest, the variables still need to be initialized because pytest is no longer initializing them.
2) To get a pytest html report, add --html=report.html from the pytest command line (not the test itself!). For the Allure report, use --alluredir=ALLURE_DIR on the command line.
3) When using other pytest fixtures, you need to use SeleniumBase as a fixture for compatibility. See: github.com/seleniumbase/SeleniumBa... for an example of the sb fixture.
Thanks, Let me try and update you.
Sorry for the trouble as I am completely new to behave.
what is "sb" ? Is it an object of some class that needs to eb instantiated in some fixture definition ?
Help appreciated.
Thanks
Sri
You're probably looking for stackoverflow.com/a/41151454 , which explains
pytest
vsbehave
and has a link topytest-bdd
.sb
is the pytest fixture for SeleniumBase. Using SeleniumBase-as-a-fixture gives you the compatibility that you need to usepytest-bdd
fixtures in your code at the same time, such asscenario
,given
,when
, andthen
. Details onpytest-bdd
can be found here: pypi.org/project/pytest-bdd/ . That is completely separate from SeleniumBase, but pytest does allow for the use of multiple fixtures at the same time.Thanks for the quick response. I will try.
Hi,
Sorry for the long post, I am trying to run sb without pytest. I found this code below from your examples.
1) Are all these settings mandatory ?
2)I am trying to use Allure reports, but its seems sb.pytest_html_report = "sb_report.html" is not generating any report , nor even logs in sb.log_path = "latest_logs/"
3) Eventually I want to create an object of sb and call from behave test steps, some how fixtures thing above didnt work for me . I want to create a SeleniumBase object in environment file before a feature starts running and use the same in test steps.
I have tried writing my own framework, but somehow I keep coming back to your work as I know I cant produce such a comprehensive and stable work ( Kudos!)
Thanks
Sri
Code:
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
if name == "main":
sb = MyTestClass("test_basic")
sb.browser = "chrome"
sb.headless = False
sb.headed = True
sb.start_page = None
sb.locale_code = None
sb.servername = "localhost"
sb.port = 4444
sb.data = None
sb.environment = "test"
sb.user_agent = None
sb.incognito = False
sb.guest_mode = False
sb.devtools = False
sb.mobile_emulator = False
sb.device_metrics = None
sb.extension_zip = None
sb.extension_dir = None
sb.database_env = "test"
sb.log_path = "latest_logs/"
sb.archive_logs = False
sb.disable_csp = False
sb.disable_ws = False
sb.enable_ws = False
sb.enable_sync = False
sb.use_auto_ext = False
sb.no_sandbox = False
sb.disable_gpu = False
sb._reuse_session = False
sb._crumbs = False
sb.visual_baseline = False
sb.maximize_option = False
sb.save_screenshot_after_test = False
sb.timeout_multiplier = None
sb.report_on = True
sb.pytest_html_report = "sb_report.html"
sb.with_db_reporting = False
sb.with_s3_logging = False
sb.js_checking_on = False
sb.is_pytest = False
sb.slow_mode = False
sb.demo_mode = False
sb.time_limit = None
sb.demo_sleep = 1
sb.message_duration = 2
sb.block_images = False
sb.settings_file = None
sb.user_data_dir = None
sb.proxy_string = None
sb.swiftshader = False
sb.ad_block_on = False
sb.highlights = None
sb.check_js = False
sb.cap_file = None
sb.cap_string = None
_
Hi,
1) When using a hack like github.com/seleniumbase/SeleniumBa... to avoid using pytest, the variables still need to be initialized because pytest is no longer initializing them.
2) To get a pytest html report, add
--html=report.html
from the pytest command line (not the test itself!). For the Allure report, use--alluredir=ALLURE_DIR
on the command line.3) When using other pytest fixtures, you need to use SeleniumBase as a fixture for compatibility. See: github.com/seleniumbase/SeleniumBa... for an example of the
sb
fixture.Hi
2) Sorry, forgot to mention. I need the report when NOT running from pytest. How do I pass these arguments when running from main?
Thanks
Sri
Hi Sri, those reports are specific to pytest plugins:
pytest-html
andallure-pytest
. You'll need to use pytest for those reports to be generated.Thanks