selenium-webdriver
Python, Ruby 및 Javascript가 포함 된 Selenium-webdriver와 CI 도구
수색…
소개
이것은 CircleCI로 셀렌 테스트를 실행하는 한 가지 방법입니다.
CircleCI와 Selenium Python 및 Unittest2의 통합
Circle.yml
machine:
python:
# Python version to use - Selenium requires python 3.0 and above
version: pypy-3.6.0
dependencies:
pre:
# Install pip packages
- pip install selenium
- pip install unittest
test:
override:
# Bash command to run main.py
- python main.py
main.py
import unittest2
# Load and run all tests in testsuite matching regex provided
loader = unittest2.TestLoader()
# Finds all the tests in the same directory that have a filename that ends in test.py
testcases = loader.discover('.', pattern="*test.py")
test_runner = unittest2.runner.TextTestRunner()
# Checks that all tests ran
success = test_runner.run(testcases).wasSuccessful()
example_test.py
class example_test(unittest.TestCase):
def test_something(self):
# Make a new webdriver instance
self.driver = webdriver.Chrome()
# Goes to www.gooogle.com
self.driver.get("https://www.google.com")
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow