├── .editorconfig ├── .gitignore ├── .inlineplz.yml ├── .pre-commit-config.yaml ├── .travis.yml ├── CHANGES.rst ├── LICENSE ├── MANIFEST ├── MANIFEST.in ├── README.rst ├── requirements-dev.txt ├── requirements.txt ├── robotframework-faker ├── FakerLibrary │ ├── __init__.py │ └── keywords.py ├── __init__.py └── doc │ └── FakerLibrary.html ├── setup.cfg ├── setup.py ├── tests ├── Faker.robot ├── Faker_localized.robot └── __init__.robot └── tox.ini /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 4 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.bat] 14 | indent_style = tab 15 | end_of_line = crlf 16 | 17 | [LICENSE] 18 | insert_final_newline = false 19 | 20 | [Makefile] 21 | indent_style = tab 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.idea 2 | .idea 3 | *.iml 4 | *.xml 5 | *.html 6 | *.egg 7 | *.tar.* 8 | *.tgz 9 | *.exe 10 | *.zip 11 | 12 | # Byte-compiled / optimized / DLL files 13 | __pycache__/ 14 | *.py[cod] 15 | *.pypirc 16 | 17 | # C extensions 18 | *.so 19 | 20 | # Distribution / packaging 21 | .Python 22 | env/ 23 | bin/ 24 | build/ 25 | develop-eggs/ 26 | dist/ 27 | eggs/ 28 | lib/ 29 | lib64/ 30 | parts/ 31 | sdist/ 32 | var/ 33 | *.egg-info/ 34 | .installed.cfg 35 | *.egg 36 | 37 | # Installer logs 38 | pip-log.txt 39 | pip-delete-this-directory.txt 40 | 41 | # Unit test / coverage reports 42 | .tox/ 43 | .coverage 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | 48 | # Translations 49 | *.mo 50 | 51 | # Mr Developer 52 | .mr.developer.cfg 53 | .project 54 | .pydevproject 55 | 56 | # Rope 57 | .ropeproject 58 | 59 | # Django stuff: 60 | *.log 61 | *.pot 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | ################# 67 | ## Eclipse 68 | ################# 69 | 70 | *.pydevproject 71 | .project 72 | .metadata 73 | bin/ 74 | tmp/ 75 | *.tmp 76 | *.bak 77 | *.swp 78 | *~.nib 79 | local.properties 80 | .classpath 81 | .settings/ 82 | .loadpath 83 | 84 | # External tool builders 85 | .externalToolBuilders/ 86 | 87 | # Locally stored "Eclipse launch configurations" 88 | *.launch 89 | 90 | # CDT-specific 91 | .cproject 92 | 93 | # PDT-specific 94 | .buildpath 95 | 96 | 97 | ################# 98 | ## Visual Studio 99 | ################# 100 | 101 | ## Ignore Visual Studio temporary files, build results, and 102 | ## files generated by popular Visual Studio add-ons. 103 | 104 | # User-specific files 105 | *.suo 106 | *.user 107 | *.sln.docstates 108 | 109 | # Build results 110 | 111 | [Dd]ebug/ 112 | [Rr]elease/ 113 | x64/ 114 | build/ 115 | [Bb]in/ 116 | [Oo]bj/ 117 | 118 | # MSTest test Results 119 | [Tt]est[Rr]esult*/ 120 | [Bb]uild[Ll]og.* 121 | 122 | *_i.c 123 | *_p.c 124 | *.ilk 125 | *.meta 126 | *.obj 127 | *.pch 128 | *.pdb 129 | *.pgc 130 | *.pgd 131 | *.rsp 132 | *.sbr 133 | *.tlb 134 | *.tli 135 | *.tlh 136 | *.tmp 137 | *.tmp_proj 138 | *.log 139 | *.vspscc 140 | *.vssscc 141 | .builds 142 | *.pidb 143 | *.log 144 | *.scc 145 | 146 | # Visual C++ cache files 147 | ipch/ 148 | *.aps 149 | *.ncb 150 | *.opensdf 151 | *.sdf 152 | *.cachefile 153 | 154 | # Visual Studio profiler 155 | *.psess 156 | *.vsp 157 | *.vspx 158 | 159 | # Guidance Automation Toolkit 160 | *.gpState 161 | 162 | # ReSharper is a .NET coding add-in 163 | _ReSharper*/ 164 | *.[Rr]e[Ss]harper 165 | 166 | # TeamCity is a build add-in 167 | _TeamCity* 168 | 169 | # DotCover is a Code Coverage Tool 170 | *.dotCover 171 | 172 | # NCrunch 173 | *.ncrunch* 174 | .*crunch*.local.xml 175 | 176 | # Installshield output folder 177 | [Ee]xpress/ 178 | 179 | # DocProject is a documentation generator add-in 180 | DocProject/buildhelp/ 181 | DocProject/Help/*.HxT 182 | DocProject/Help/*.HxC 183 | DocProject/Help/*.hhc 184 | DocProject/Help/*.hhk 185 | DocProject/Help/*.hhp 186 | DocProject/Help/Html2 187 | DocProject/Help/html 188 | 189 | # Click-Once directory 190 | publish/ 191 | 192 | # Publish Web Output 193 | *.Publish.xml 194 | *.pubxml 195 | 196 | # NuGet Packages Directory 197 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 198 | #packages/ 199 | 200 | # Windows Azure Build Output 201 | csx 202 | *.build.csdef 203 | 204 | # Windows Store app package directory 205 | AppPackages/ 206 | 207 | # Others 208 | sql/ 209 | *.Cache 210 | ClientBin/ 211 | [Ss]tyle[Cc]op.* 212 | ~$* 213 | *~ 214 | *.dbmdl 215 | *.[Pp]ublish.xml 216 | *.pfx 217 | *.publishsettings 218 | 219 | # RIA/Silverlight projects 220 | Generated_Code/ 221 | 222 | # Backup & report files from converting an old project file to a newer 223 | # Visual Studio version. Backup files are not needed, because we have git ;-) 224 | _UpgradeReport_Files/ 225 | Backup*/ 226 | UpgradeLog*.XML 227 | UpgradeLog*.htm 228 | 229 | # SQL Server files 230 | App_Data/*.mdf 231 | App_Data/*.ldf 232 | 233 | ############# 234 | ## Windows detritus 235 | ############# 236 | 237 | # Windows image file caches 238 | Thumbs.db 239 | ehthumbs.db 240 | 241 | # Folder config file 242 | Desktop.ini 243 | 244 | # Recycle Bin used on file shares 245 | $RECYCLE.BIN/ 246 | 247 | # Mac crap 248 | .DS_Store 249 | 250 | 251 | ############# 252 | ## Python 253 | ############# 254 | 255 | *.py[co] 256 | 257 | # Packages 258 | *.egg 259 | *.egg-info 260 | dist/ 261 | build/ 262 | eggs/ 263 | parts/ 264 | var/ 265 | sdist/ 266 | develop-eggs/ 267 | .installed.cfg 268 | 269 | # Installer logs 270 | pip-log.txt 271 | 272 | # Unit test / coverage reports 273 | .coverage 274 | .tox 275 | 276 | #Translations 277 | *.mo 278 | 279 | #Mr Developer 280 | .mr.developer.cfg 281 | 282 | #PyCharm 283 | .idea 284 | -------------------------------------------------------------------------------- /.inlineplz.yml: -------------------------------------------------------------------------------- 1 | ignore_paths: 2 | - node_modules 3 | - .tox 4 | - .git 5 | enabled_linters: 6 | - prospector 7 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | - repo: git://github.com/pre-commit/pre-commit-hooks 2 | sha: fea9b2ece73cfac7e0246e6d84bcd1dfce5bce1b 3 | hooks: 4 | - id: trailing-whitespace 5 | - id: end-of-file-fixer 6 | - id: autopep8-wrapper 7 | args: 8 | - -i 9 | - --ignore=E265,E309,E501 10 | - -v 11 | - id: check-json 12 | - id: check-yaml 13 | - id: check-added-large-files 14 | - id: check-case-conflict 15 | - id: check-docstring-first 16 | - id: debug-statements 17 | - id: requirements-txt-fixer 18 | - id: name-tests-test 19 | - id: flake8 20 | args: 21 | - --max-line-length=100 22 | - --max-complexity=10 23 | - repo: git://github.com/asottile/reorder_python_imports 24 | sha: ab361ca1e4dfaeea0c4eab464c799e02cb306ab3 25 | hooks: 26 | - id: reorder-python-imports 27 | - repo: git://github.com/guykisel/pre-commit-robotframework-tidy 28 | sha: 07d9ed1dea81d8c0abc783a8f3469ca01801004b 29 | hooks: 30 | - id: robotframework-tidy-wrapper 31 | - repo: git://github.com/guykisel/prospector-mirror 32 | sha: 00fbd80101566b1b9c873c71f2ab7b95b8bd0a7d 33 | hooks: 34 | - id: prospector 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | deploy: 2 | on: 3 | condition: "$TRAVIS_PYTHON_VERSION == 3.8" 4 | repo: guykisel/robotframework-faker 5 | tags: true 6 | distributions: sdist bdist_wheel 7 | password: 8 | secure: H1dqNgZkfbSJ4ERULyniPhdKssB1L676PXkj3LDr6AW8gX/PTTe5eKwbnqQiV9Q86rScv3IJ10B8jHJ94GoMTMq/+8XZ+K4VEKoIGhmy31/3Q8faIdGcNgrCaDoyUj9ml1HP0/yr0sZjBEyEkomAb+HClrwKAOoDszyeTPgZJZM= 9 | provider: pypi 10 | user: guykisel 11 | install: 12 | - pip install -U pip 13 | - pip install tox-travis 14 | - pip install -r requirements-dev.txt 15 | - python setup.py develop 16 | language: python 17 | python: 18 | - '3.8' 19 | - '3.7' 20 | - '3.6' 21 | script: 22 | - tox 23 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | Changelog for robotframework-faker 2 | =========================== 3 | 4 | 5.0.0 (2020-01-30) 5 | ------------------ 6 | 7 | - Dropped Python 2.7 support since faker no longer supports it. 8 | 9 | 4.0.1 (2016-12-19) 10 | ------------------ 11 | 12 | - Fixed line feeds in CHANGES.rst and setup.py 13 | - Removed unneeded Python 2.6 workarounds in Travis-CI config. 14 | 15 | 16 | 4.0.0 (2016-12-19) 17 | ------------------ 18 | 19 | - fake-factory was renamed to faker. (thanks @funkymonkeymonk) 20 | - Dropped Python 2.6 support since faker no longer supports it. (thanks @funkymonkeymonk) 21 | 22 | 23 | 3.0.0 (2015-02-05) 24 | ------------------ 25 | 26 | - Use robotframework syntax highlighting in README.rst examples. 27 | (thanks @pekkaklarck) 28 | - Autocast string inputs to their most likely types. Adds wrapt as a dependency. 29 | NOTE: This change breaks some backwards-compatibility. 30 | - Set up static analysis in Travis-CI. 31 | 32 | 33 | 2.0.4 (2014-10-09) 34 | ------------------ 35 | 36 | - Remove changelog from PyPI long_description, it breaks the rst rendering :( 37 | 38 | 39 | 2.0.3 (2014-10-09) 40 | ------------------ 41 | 42 | - Fixed example in README. 43 | - Add changelog to PyPI long_description. 44 | 45 | 46 | 2.0.2 (2014-10-09) 47 | ------------------ 48 | 49 | - Hotfix: Fix README.rst for PyPI compatibility. 50 | 51 | 52 | 2.0.1 (2014-10-09) 53 | ------------------ 54 | 55 | - Hotfix: Deleted invalid classifier. 56 | 57 | 58 | 2.0.0 (2014-10-09) 59 | ------------------ 60 | 61 | - Removed autocasting of input variables. This change is backwards 62 | incompatible! Going forward, to input non-string data types to FakerLibrary 63 | keywords, you must format them using RF's syntax for those data types. 64 | For example, the integer 3 would be ${3}. 65 | - Began using zest.releaser for automated packaging and releasing. 66 | - Added pre-commit configuration to ensure PEP-8 compliance. 67 | - Switched README to restructuredtext to improve rendering on PyPI. 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Guy Kisel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | LICENSE 3 | MANIFEST 4 | MANIFEST.in 5 | README.rst 6 | requirements.txt 7 | setup.cfg 8 | setup.py 9 | robotframework-faker/FakerLibrary/__init__.py 10 | robotframework-faker/FakerLibrary/keywords.py 11 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | 2 | include *.txt 3 | recursive-include docs *.txt 4 | include README.rst LICENSE MANIFEST.in MANIFEST 5 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | robotframework-faker 2 | ==================== 3 | 4 | .. image:: https://travis-ci.org/marketsquare/robotframework-faker.svg?branch=master 5 | :target: https://pypi.python.org/pypi/robotframework-faker 6 | .. image:: https://img.shields.io/pypi/v/robotframework-faker.svg 7 | :target: https://pypi.python.org/pypi/robotframework-faker 8 | .. image:: https://img.shields.io/pypi/dm/robotframework-faker.svg 9 | :target: https://pypi.python.org/pypi/robotframework-faker 10 | .. image:: https://img.shields.io/pypi/l/robotframework-faker.svg 11 | :target: https://pypi.python.org/pypi/robotframework-faker 12 | 13 | Robot Framework keyword library wrapper for 14 | `Faker `__. 15 | 16 | This module allows easy use of Faker's random test data generation in 17 | Robot Framework. I hate using static test data, because inevitably the 18 | system under test evolves to pass the tests without necessarily solving 19 | the root cause of bugs. 20 | 21 | Any docstrings Faker provides are passed through to Robot Framework, so 22 | they're available in RIDE and in keyword documentation generated via 23 | libdoc. 24 | 25 | For more information on Robot Framework please visit `the Robot 26 | Framework homepage! `__ 27 | 28 | Installation 29 | ------------ 30 | 31 | ``pip install robotframework-faker`` 32 | 33 | Usage 34 | ----- 35 | 36 | `FakerLibrary keyword 37 | documentation `__ 38 | 39 | .. code:: robotframework 40 | 41 | *** Settings *** 42 | Library FakerLibrary 43 | 44 | *** Test Cases *** 45 | FakerLibrary Words Generation 46 | ${words}= FakerLibrary.Words 47 | Log words: ${words} 48 | ${words}= FakerLibrary.Words nb=${10} 49 | Log words: ${words} 50 | 51 | You can also specify seeds and providers: 52 | 53 | .. code:: robotframework 54 | 55 | *** Settings *** 56 | Library FakerLibrary locale=de_DE seed=124 57 | 58 | See `FakerLibrary's tests `__ for more usage examples. 59 | 60 | Contribute 61 | ---------- 62 | 63 | If you like this module, please contribute! I welcome patches, 64 | documentation, issues, ideas, and so on. 65 | 66 | 67 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | -e . 2 | bumpversion 3 | flake8 4 | pre-commit 5 | prospector 6 | tox 7 | -r requirements.txt -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | faker==8.11.0 2 | robotframework 3 | wrapt 4 | -------------------------------------------------------------------------------- /robotframework-faker/FakerLibrary/__init__.py: -------------------------------------------------------------------------------- 1 | import pkg_resources 2 | from .keywords import FakerKeywords 3 | 4 | 5 | __version__ = pkg_resources.get_distribution("robotframework-faker").version 6 | 7 | 8 | class FakerLibrary(FakerKeywords): 9 | """ 10 | 11 | """ 12 | 13 | ROBOT_LIBRARY_SCOPE = "GLOBAL" 14 | -------------------------------------------------------------------------------- /robotframework-faker/FakerLibrary/keywords.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | This is a very thin wrapper for faker. You can access all of faker's usual 4 | methods via FakerLibrary calls in Robot Framework. 5 | 6 | """ 7 | # pylint: disable=no-value-for-parameter,unused-argument,useless-object-inheritance 8 | import ast 9 | 10 | import faker.factory 11 | import faker.generator 12 | import wrapt 13 | 14 | 15 | def _str_to_data(string): 16 | try: 17 | return ast.literal_eval(str(string).strip()) 18 | except Exception: 19 | return string 20 | 21 | 22 | @wrapt.decorator 23 | def _str_vars_to_data(f, instance, args, kwargs): 24 | args = [_str_to_data(arg) for arg in args] 25 | kwargs = dict( 26 | (arg_name, _str_to_data(arg)) for arg_name, arg in kwargs.items() 27 | ) 28 | result = f(*args, **kwargs) 29 | return result 30 | 31 | 32 | class FakerKeywords(object): 33 | """ 34 | This looks tricky but it's just the Robot Framework Hybrid Library API. 35 | http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html#hybrid-library-api 36 | """ 37 | 38 | ROBOT_LIBRARY_SCOPE = "Global" 39 | _fake = faker.factory.Factory.create() 40 | 41 | def __init__(self, locale=None, providers=None, seed=None): 42 | self._fake = faker.factory.Factory.create(locale, providers) 43 | if seed: 44 | self._fake.seed(seed) 45 | 46 | def get_keyword_names(self): 47 | keywords = [ 48 | name 49 | for name, function in self._fake.__dict__.items() 50 | if hasattr(function, "__call__") 51 | ] 52 | 53 | keywords.extend( 54 | [ 55 | name 56 | for name, function in faker.generator.Generator.__dict__.items() 57 | if hasattr(function, "__call__") 58 | ] 59 | ) 60 | 61 | keywords.append("seed") 62 | 63 | return keywords 64 | 65 | @_str_vars_to_data 66 | def seed(self, seed=None): 67 | self._fake.seed(seed) 68 | 69 | def __getattr__(self, name): 70 | func = None 71 | if name.strip().lower() == "seed": 72 | return self.seed 73 | if name in self._fake.__dict__.keys(): 74 | func = getattr(self._fake, name) 75 | elif name in faker.generator.Generator.__dict__.keys(): 76 | func = faker.generator.Generator.__dict__[name] 77 | if func: 78 | return _str_vars_to_data(func) 79 | raise AttributeError('Non-existing keyword "{0}"'.format(name)) 80 | -------------------------------------------------------------------------------- /robotframework-faker/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | __author__ = "Guy Kisel" 5 | __email__ = "guy.kisel@gmail.com" 6 | __version__ = "5.0.0" 7 | -------------------------------------------------------------------------------- /robotframework-faker/doc/FakerLibrary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 160 | 230 | 243 | 266 | 317 | 520 | 524 | 536 | 549 | 552 | 553 | 554 | 555 | 556 |
557 |

Opening library documentation failed

558 |
    559 |
  • Verify that you have JavaScript enabled in your browser.
  • 560 |
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 8 or newer is required.
  • 561 |
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • 562 |
563 |
564 | 565 | 569 | 570 | 770 | 771 | 816 | 817 | 836 | 837 | 848 | 849 | 860 | 861 | 877 | 878 | 900 | 901 | 902 | 910 | 911 | 912 | 913 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 5.0.0 3 | commit = True 4 | tag = True 5 | 6 | [metadata] 7 | description-file = README.md 8 | 9 | [bumpversion:file:setup.py] 10 | 11 | [bumpversion:file:robotframework-faker/__init__.py] 12 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from setuptools import setup 3 | 4 | short_description = ( 5 | "Robot Framework wrapper for faker, a fake test data generator" 6 | ) 7 | try: 8 | description = open("README.rst").read() 9 | except IOError: 10 | description = short_description 11 | 12 | 13 | classifiers = """ 14 | Development Status :: 5 - Production/Stable 15 | License :: OSI Approved :: MIT License 16 | Operating System :: OS Independent 17 | Programming Language :: Python 18 | Programming Language :: Python :: 3 19 | Programming Language :: Python :: 3 :: Only 20 | Programming Language :: Python :: 3.5 21 | Programming Language :: Python :: 3.6 22 | Programming Language :: Python :: 3.7 23 | Programming Language :: Python :: 3.8 24 | Topic :: Software Development :: Testing 25 | Topic :: Software Development :: Quality Assurance 26 | """.strip().splitlines() 27 | 28 | setup( 29 | name="robotframework-faker", 30 | package_dir={"": "robotframework-faker"}, 31 | packages=["FakerLibrary"], # this must be the same as the name above 32 | version="5.0.0", 33 | description=short_description, 34 | author="Guy Kisel", 35 | author_email="guy.kisel@gmail.com", 36 | url="https://github.com/guykisel/robotframework-faker", 37 | download_url="https://pypi.python.org/pypi/robotframework-faker", 38 | keywords=( 39 | "robotframework testing " 40 | "test automation testautomation " 41 | "atdd bdd faker" 42 | ), # arbitrary keywords 43 | install_requires=["faker", "robotframework", "wrapt"], 44 | long_description=description, 45 | license="MIT", 46 | classifiers=classifiers, 47 | platforms="any", 48 | ) 49 | -------------------------------------------------------------------------------- /tests/Faker.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Force Tags faker 3 | Test Timeout 1 minute 4 | Library FakerLibrary 5 | 6 | *** Test Cases *** 7 | Can Get Fake Name 8 | ${name}= FakerLibrary.Name 9 | Should Not Be Empty ${name} 10 | 11 | Two Calls To Faker Should Give Different Results 12 | ${name}= FakerLibrary.Name 13 | Should Not Be Empty ${name} 14 | ${name2}= FakerLibrary.Name 15 | Should Not Be Empty ${name2} 16 | Should Not Be Equal As Strings ${name} ${name2} 17 | 18 | Two Calls To Faker With Same Seed Should Give Same Results 19 | FakerLibrary.Seed 5 20 | ${name}= FakerLibrary.Name 21 | Should Not Be Empty ${name} 22 | FakerLibrary.Seed ${5} 23 | ${name2}= FakerLibrary.Name 24 | Should Not Be Empty ${name2} 25 | Should Be Equal As Strings ${name} ${name2} 26 | 27 | Can Seed Faker 28 | FakerLibrary.Seed ${5} 29 | FakerLibrary.Seed seed 30 | FakerLibrary.Seed 31 | 32 | Can Seed Faker with str integer argument 33 | FakerLibrary.Seed 5 34 | 35 | Can call Words with integer argument 36 | ${WordsList}= Words nb=${10} 37 | Log ${WordsList} 38 | Length Should Be ${WordsList} 10 39 | 40 | Can call Words with str integer argument 41 | ${WordsList}= Words nb=10 42 | Log ${WordsList} 43 | Length Should Be ${WordsList} 10 44 | 45 | Can call SHA-1 46 | SHA1 47 | SHA1 ${True} 48 | SHA1 ${False} 49 | SHA1 True 50 | SHA1 False 51 | 52 | Can Lexify 53 | ${lexed}= Lexify blah??? 54 | Length Should Be ${lexed} 7 55 | Should Start With ${lexed} blah 56 | 57 | Can call Password 58 | ${pass}= Password 59 | Length Should Be ${pass} 10 60 | ${pass}= Password ${5} 61 | Length Should Be ${pass} 5 62 | ${pass}= Password 5 63 | Length Should Be ${pass} 5 64 | ${pass}= Password special_chars=${False} 65 | ${pass}= Password special_chars=${True} 66 | ${pass}= Password digits=${True} 67 | ${pass}= Password digits=${False} 68 | ${pass}= Password digits=True 69 | ${pass}= Password digits=False 70 | ${pass}= Password upper_case=${True} 71 | ${pass}= Password lower_case=${True} 72 | ${pass}= Password digits=${False} 73 | ${pass}= Password 5823 ${True} ${False} ${True} ${True} 74 | Length Should Be ${pass} 5823 75 | ${pass}= Password ${5823} ${True} ${False} ${True} ${True} 76 | Length Should Be ${pass} 5823 77 | 78 | *** Keywords *** 79 | -------------------------------------------------------------------------------- /tests/Faker_localized.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Force Tags faker 3 | Test Timeout 1 minute 4 | 5 | *** Test Cases *** 6 | Import With Locale 7 | Import Library FakerLibrary de_DE 8 | Import Library FakerLibrary en_US 9 | Import Library FakerLibrary ko_KR 10 | Import Library FakerLibrary es_MX 11 | 12 | Import With Explicit Locale 13 | Import Library FakerLibrary locale=de_DE 14 | 15 | Import With Explicit Seed 16 | Import Library FakerLibrary seed=124 17 | 18 | Import With Explicit Locale And Seed 19 | Import Library FakerLibrary locale=de_DE seed=124 20 | 21 | Import With Explicit Locale And Seed And No Providers 22 | Import Library FakerLibrary locale=de_DE providers=${None} seed=124 23 | -------------------------------------------------------------------------------- /tests/__init__.robot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarketSquare/robotframework-faker/fadcec71b5367d8de27de3769bc112aac74b0d6e/tests/__init__.robot -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py36, py37, py38 3 | 4 | [testenv] 5 | passenv = HOME LOCALAPPDATA 6 | commands = robot tests 7 | prospector 8 | deps = -rrequirements-dev.txt 9 | --------------------------------------------------------------------------------