首页 > 解决方案 > 不会收集班级内的测试

问题描述

我有一个问题,我似乎无法找到解决方法。我有一个基础测试类,我在其中初始化驱动程序,并将其扩展到我的测试,但是,我的其余测试没有被拾取。

这是我的基本测试类

from fbtests.pages import Pages


class BaseTest:
  def __init__(self, driver):
    self.driver = driver
    self.pages = Pages(driver)
    print('I do this')

这是我尝试运行的主要测试

from nose.tools import istest
from utils.misc import selenium_testcase
from fbtests.BaseTest import BaseTest


@istest
@selenium_testcase
class SmokeTest(BaseTest):
  def test_smoke_homepage_country(self):
    print('I dont enter here')

    """Check successful country tests from the homepage

    Scenario:
    Search and assert country pages through URL

    Steps:
    1. Go to home page
    2. Search state through a URL parameter
    3. Assert that the country landing page is visible

    """
    # pages = Pages(driver)
    list_of_countries = {'us', 'mx', 'mv', 'au', 'bg'}
    for country in list_of_countries:
        self.pages.home.visit('platform', 'homepage', '/charters/search/' + str(country))
    self.test_smoke_homepage_country()

SmokeTest(BaseTest) 被选中,但是 test_smoke_homepage_country 没有。

浏览器只是打开和关闭消息:

2021-08-05 09:38:06,949 -nose.importer - 调试 - 添加路径 /Users/dusandev/miniconda3/envs/orqa/bin fbtests.teams.customer.test_smoke.SmokeTest ...我这样做没问题


在 3.124 秒内运行 1 次测试

好的

在参数下的运行/调试配置中,我有以下内容: run_tests -c config/orqa.yaml fbtests.teams.customer.test_smoke:SmokeTest -v --nocapture

我似乎无法找出为什么它不运行该方法。预先感谢您的帮助。

标签: pythonseleniumnose

解决方案


推荐阅读