def run(self, args): try: if args and args[0] == 'rebot': rebot_from_cli(args[1:], rebot.__doc__) else: run_from_cli(args, runner.__doc__) except SystemExit, err: return err.code
def run_cli(args): # abstracts away this change # https://code.google.com/p/robotframework/source/detail?r=ebc6fbb542e6 # so we can test this lib against RF 2.6 and 2.7 w/o much config overhead import robot try: robot.run_cli(args) except Exception, e: print e import robot.runner robot.run_from_cli(args, robot.runner.__doc__)
def run_cli(args): # abstracts away this change # https://code.google.com/p/robotframework/source/detail?r=ebc6fbb542e6 # so we can test this lib against RF 2.6 and 2.7 w/o much config overhead import robot try: robot.run_cli(args) except Exception as e: print(e) import robot.runner robot.run_from_cli(args, robot.runner.__doc__)
def shell(): '''A standalone robotframework shell''' import tempfile # ceate test suite file for REPL. source = tempfile.NamedTemporaryFile(prefix='robot_debug', suffix='.txt', delete=False) source.write('''*** Settings *** Library DebugLibrary ** test case ** REPL debug ''') source.flush() args = '-l None -x None -o None -L None ' + source.name import robot try: from robot import run_cli rc = run_cli(args.split()) except ImportError: import robot.runner rc = robot.run_from_cli(args.split(), robot.runner.__doc__) source.close() if os.path.exists(source.name): os.unlink(source.name) sys.exit(rc)
def shell(): '''A standalone robotframework shell''' import tempfile # ceate test suite file for REPL. source = tempfile.NamedTemporaryFile(prefix='robot_debug', suffix='.txt', delete=False) source.write(b'''*** Settings *** Library DebugLibrary ** test case ** REPL debug ''') source.flush() args = '-l None -x None -o None -L None ' + source.name import robot try: from robot import run_cli rc = run_cli(args.split()) except ImportError: import robot.runner rc = robot.run_from_cli(args.split(), robot.runner.__doc__) source.close() if os.path.exists(source.name): os.unlink(source.name) sys.exit(rc)
def shell(): '''A standalone robotframework shell''' import tempfile # ceate test suite file for REPL. source = tempfile.NamedTemporaryFile(prefix='robot_debug', suffix='.txt') source.write('''*** Settings *** Library DebugLibrary ** test case ** REPL debug ''') source.flush() import robot import robot.runner args = '-l None -x None -o None -L None ' + source.name robot_version = robot.version.get_version() if robot_version > '2.7': rc = robot.run_cli(args.split()) else: rc = robot.run_from_cli(args.split(), robot.runner.__doc__) sys.exit(rc)
$ jybot --include smoke --name Smoke_Tests /path/to/tests.html # Running 'robot/runner.py' directly and using test data in TSV format. $ python /path/to/robot/runner.py tests.tsv # Using custom start-up script, giving multiple options and executing a dir. $ runtests.sh --test test1 --test test2 testdir/ # Executing multiple data sources and using case-insensitive long options. $ pybot --SplitOutputs 1 /my/tests/*.html /your/tests.html # Setting syslog file before running tests. $ export ROBOT_SYSLOG_FILE=/tmp/syslog.txt $ pybot tests.html """ import sys try: import pythonpathsetter except ImportError: # Get here when run as 'python -m robot.runner' and then importing robot # works without this and pythonpathsetter is imported again later. pass import robot if __name__ == '__main__': robot.run_from_cli(sys.argv[1:], __doc__)
# Using options and running with 'jybot'. $ jybot --include smoke --name Smoke_Tests /path/to/tests.html # Running 'robot/runner.py' directly and using test data in TSV format. $ python /path/to/robot/runner.py tests.tsv # Using custom start-up script, giving multiple options and executing a dir. $ runtests.sh --test test1 --test test2 testdir/ # Executing multiple data sources and using case-insensitive long options. $ pybot --SplitOutputs 1 /my/tests/*.html /your/tests.html # Setting syslog file before running tests. $ export ROBOT_SYSLOG_FILE=/tmp/syslog.txt $ pybot tests.html """ import sys try: import pythonpathsetter except ImportError: # Get here when run as 'python -m robot.runner' and then importing robot # works without this and pythonpathsetter is imported again later. pass import robot if __name__ == '__main__': robot.run_from_cli(sys.argv[1:], __doc__)