seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.67k stars 929 forks source link

Need to manually combine the recorded individual test case into a test suite before running the test suite? #1744

Closed anlanone closed 1 year ago

anlanone commented 1 year ago

Hi,@mdmintz, Recently, I am learning your SleniumBase automated testing framework. There are three questions I would like to ask.

First, I see that you have provided two pytest commands to generate automated test reports, which are _pytest testsuite.py --html=report.html and _pytest test_suite.py --dashboard_.I see that the recording script is saved in one test case method at a time, and the test suite contains multiple use case methods. Does _this testsuite.py require the user to integrate multiple recording scripts into one suite? Or is there any other way to run multiple test cases sequentially to generate test reports?

Second, are the implementation principles of the report-html and dashboard test reports both built-in functions of pytest?

Third, when playing back the script, what is the speed delay of --slow slow playback and --demo demo mode playback? Where in the code can I see this?

Looking forward to your answer.

mdmintz commented 1 year ago

Hello @anlanone,

  1. If you run pytest without specifying a file, it'll run all tests that it finds based on pytest discovery rules. All test files that start with test_ or end with _test.py will get picked up. Test methods that start with test_ will get picked up. The class name doesn't matter as long as tests inherit BaseCase. Then you can add additional args for advanced features such as reports and dashboards (--html=report.html / --dashboard). You can also group tests together using pytest markers. The SeleniumBase Recorder can help you generate tests.

  2. pytest-html is a separate dependency that includes html reports. (It is included with SeleniumBase dependencies.) The Dashboard comes built-in with SeleniumBase.

  3. --slow adds 0.5s between actions. With --demo, there is an animation that highlights actions, which lasts close to 1s. Many timeout values can be found here.