簡體   English   中英

如何在行為 python 的 2 個背景中運行同一組場景

[英]how to run same set of scenarios in 2 backgrounds in behave python

我的登錄頁面有 2 個背景 1) 用戶接受 cookie 2) 用戶拒絕 cookies。

Feature:ORG_LOGIN|Login action with organization ID after accepting cookies

  Background:
    Given User is on login page
    When user accepts the cookies
    And User navigates to organization tab
    And clicks on password eye


#  @positive
#  Scenario:Login with valid credentials
#    When User enters valid Organization ID, username and password
#    And hits Login button
#    Then Dashboard page is displayed

在此之后,需要測試同一組場景(8 個)。

我正在使用 behave 1.2.6 和 python 3.11.0 和 selenium 4.6.0

Since there can be only 1 background per feature file, I tried copying all scenarios into another feature file with different background. I get following error

behave.step_registry.AmbiguousStep: @given('User is on login page') has already been defined in existing step @given('User is on login page') at steps/login_ac.py:8

任何想法我該如何實施。

我通過刪除步驟的重復實現來解決它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM