Snooz82 / robotframework-datadriver

Library to provide Data-Driven testing with CSV tables to Robot Framework
Apache License 2.0
131 stars 37 forks source link

-i tags does not work when [Tags] is column in excel sheet #82

Closed tongercore closed 1 year ago

tongercore commented 1 year ago

I have:

*** Settings ***
Resource          ../Resources/AllResources.robot
Library    DataDriver  file=TestDataToevoegenDocumentenpbr.xlsx  sheet_name=Sheet1
Suite Setup    LoginApp.Inloggen En Gebruikersportaal Openen NonSSO
Test Template    Toevoegen Doc-Id
Suite Teardown    Common.End Web Test
Default Tags    Bacon

*** Test Cases ***
Scenarios Toevoegen Doc-Id   ${bronsysteem}    ${procescode}

*** Keywords ***
Toevoegen Doc-Id
    [Arguments]    ${bronsysteem}    ${procescode}
    Leftmenu.Klik Plus Button
    Leftmenu.Klik Aanmaken Document Intake    
    Intake.Selecteer Bronsysteem    ${bronsysteem}
    Intake.Selecteer Procescode    ${procescode}

In my XLSX sheet I have:

*** Test   Cases ***   | [Tags]      |${bronsysteem}      | ${procescode}
Taak Overdragen TG01A  |             | Iris               | IG
Taak Overdragen TG01B  | Smoke       | Iris               | IG
Taak Overdragen TG01C  |             | Iris               | IG

When I only want to run the test with the tag Smoke with the command as stated below: robot -d results --include Smoke Tests/ToevoegenDoc-ID.robot

Results in error: Suite 'ToevoegenDoc-ID' contains no tests matching tag 'Smoke

What am I doing wrong here?

Kind regards, Marco

fsJerryChan commented 1 year ago

Hi, I have the same issue. Have u had any solution on it?

fsJerryChan commented 1 year ago

Hi brother,

I fixed this issue. You should use the robot command below:

robot -d results --include BaconORSmoke Tests/ToevoegenDoc-ID.robot

I think you lack the default tag. You can try it.

vuppulaBhanuprakash commented 1 year ago

why you use Bacon?

Snooz82 commented 1 year ago

you have to use a tag to include that is assigned in the robot file to the template test. If you have not assigned any tag to the template test, robot will not execute that suite at all and DataDriver has no chance to generate the test cases.

One option is, to set the import argument of DataDriver handle_template_tags to NoTags so that non of the template tags are added to the generated tests. And then include that tag always.

example:

*** Settings ***
Resource          ../Resources/AllResources.robot
Library    DataDriver  file=TestDataToevoegenDocumentenpbr.xlsx  sheet_name=Sheet1    handle_template_tags=NoTags
Suite Setup    LoginApp.Inloggen En Gebruikersportaal Openen NonSSO
Test Template    Toevoegen Doc-Id
Suite Teardown    Common.End Web Test
Test Tags    DataDriver

*** Test Cases ***
Scenarios Toevoegen Doc-Id   ${bronsysteem}    ${procescode}

*** Keywords ***
Toevoegen Doc-Id
    [Arguments]    ${bronsysteem}    ${procescode}
    Leftmenu.Klik Plus Button
    Leftmenu.Klik Aanmaken Document Intake    
    Intake.Selecteer Bronsysteem    ${bronsysteem}
    Intake.Selecteer Procescode    ${procescode}
Test Cases [Tags] ${bronsysteem} ${procescode}
Taak Overdragen TG01A Iris IG
Taak Overdragen TG01B Smoke Iris IG
Taak Overdragen TG01C Iris IG

call with like: robot -d results --include Smoke --include DataDriver Tests/ToevoegenDoc-ID.robot