Reputation: 10469
I have this structure in my project:
Tests
|__ Keywords
|__ Keywords.robot
|__ Libs
|__ Scenarios
|__ UI
|__ TestScen.robot
|__ Variables
|__ Variables.robot
|__ RunTest.py
This is TestScen.robot
:
*** Settings ***
Library Selenium2Library
Resource ../../Variables/Variables.robot
*** Variables ***
*** Keywords ***
Test Login
log to console Test Login
go to ${url}
Input Text id=${uNameId} ${uiUserName}
Input Text id=${passId} ${uiPassword}
Click Element id=${signInId}
log to console YaaaaY!
This is RunTest.py
:
import argparse
from robot import run
import os
import datetime
import sys
def get_args():
parser = argparse.ArgumentParser(description='Robot Test Framework')
parser.add_argument('--file',
metavar='f',
default="Scenarios",
help='get path of root scenario')
parser.add_argument('--testSuite',
metavar='"scenario name"',
default=[],
nargs='*',
help='get names of test suits')
parser.add_argument('--tags',
metavar='tag',
default=[],
nargs='*',
help='get name of tags')
parser.add_argument('--testCases',
metavar='testCases',
default=[],
nargs='*',
help='get name of testCases')
parser.add_argument('--skip',
metavar='skip',
default=["skip"],
nargs='*',
help='get name of skip testCases')
args = parser.parse_args()
return args
if __name__ == "__main__":
dir_name = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
os.mkdir('Output/' + dir_name)
args = get_args()
run(
args.file,
report='Output/' + dir_name + '/report.html',
log='Output/' + dir_name + '/log.html',
output='Output/' + dir_name + '/output.xml',
include=args.tags,
test=args.testCases,
exclude=args.skip,
critical="Critical",
suite=args.testSuite
)
I run RunTest.py
this way:
python RunTest.py --file Scenarios/UI
This is the output:
[ ERROR ] Suite 'UI' contains no tests.
Try --help for usage information.
What is the problem? Why framework does not recognize my scenario file??
Upvotes: 1
Views: 7243
Reputation: 386275
Your file has no test cases. You have settings, variables and keywords, but no test cases.
My guess is that what you have under "Keywords" is actually a test case. Change the heading of that table like this:
*** Test cases ***
Test Login
log to console Test Login
...
Upvotes: 3