FauxFactory generates random data for your automated tests easily!

Related tags

Testing fauxfactory
Overview

FauxFactory

Build Status Python Compatibility Current Version Download Statistics Test Coverage License

FauxFactory generates random data for your automated tests easily!

There are times when you're writing tests for your application when you need to pass random, non-specific data to the areas you are testing. For these scenarios when all you need is a random string, numbers, dates, times, email address, IP, etc, then FauxFactory can help!

The full documentation is available on ReadTheDocs. It can also be generated locally:

pip install -r requirements-optional.txt
make docs-html
Comments
  • Add python-2.6 support

    Add python-2.6 support

    Support python-2.6

    • Adds a tox.ini to facilitate testing supported py_versions
    • Add a requirements-optional-26.txt file
    • Update fauxfactory/init.py to support 2.6 syntax
    • updates tests/test_*.py to conditionally import unittest2
    • Add 2.6 to .travis.yml
    opened by jlaska 22
  • Enable passing a prefix for IP addresses

    Enable passing a prefix for IP addresses

    I hope tests say all, intended to replace https://github.com/RedHatQE/cfme_tests/blob/master/utils/randomness.py#L5

    btw. what's wrong on map(str, prefix_ipv4 or []) ? Shorter than the list comprehension :smile:

    opened by mfalesni 12
  • gen_integer() change

    gen_integer() change

    Using Win64 Python2.7, sys.maxsize returns a long and the isinstance(maxsize, int) test fails. I updated this to a tuple to consider the differences with Python3 (which doesn't really use long()) by adding an integer types tuple (int, long,) depending on the platform.

    opened by apense 12
  • Add unicode letters generator

    Add unicode letters generator

    This generator is a helper for the gen_utf8 function which will provide the system supported list of unicode letters. This will avoid generating unicode string with control characters and other non letters characters.

    Also adds tests for the generator in order to ensure it is not generating unwanted characters.

    Closes #69

    opened by elyezer 11
  • Add valid netmask random generator

    Add valid netmask random generator

    I was motivated to create this because this regex used to validate netmasks https://github.com/theforeman/foreman/blob/develop/lib/net/validations.rb#L8.

    Also got some info at http://www.iplocation.net/tools/netmask.php.

    opened by elyezer 11
  • allow zero-length strings

    allow zero-length strings

    Methods like generate_alphanumeric and generate_alpha allow the user to choose how long the resultant string should be. Each of those string generation methods checks length to ensure that the value is an integer and is not too short. There are two problems here:'

    1. A length of zero is not allowed. That doesn't make sense. A user should be able to generate a zero-length string if they so desire.
    2. The validation logic in each method is identical. It should be refactored out into a single private method.
    opened by Ichimonji10 10
  • don't install tests into the binary distribution

    don't install tests into the binary distribution

    this tries to install a "tests" python package, which we don't own. at the same time, also exclude docs and contrib as done in the PyPA sample project [1]

    [1] https://github.com/pypa/sampleproject/blob/master/setup.py

    opened by evgeni 9
  • Added a method gen_vm_mac() to generate valid mac for QEMU/KVM virtual machines

    Added a method gen_vm_mac() to generate valid mac for QEMU/KVM virtual machines

    For discovery feature, I need a valid mac that I can use for VM provisioning. However the current gen_mac() doesn't generate a valid mac for VM's on QEMU/KVM. The mac address must start with sequence: 54:52:00 otherwise VM creation fails with error:

    ERROR XML error: expected unicast mac address, found multicast '63:8e:b3:53:77:b1'

    So I added a new method to generate vm mac. gen_vm_mac(). We can update existing one too if that's the best option ?

    opened by sghai 9
  • Introduce formatted string generator

    Introduce formatted string generator

    Introduce fauxfactory.generate() which takes a string with formatting similar to "".format() but instead of inserting strings, it randomizes the values based on what is located inside the braces.

    opened by mfalesni 9
  • [DONOTMERGE] Simplified ``FauxFactory`` class definition.

    [DONOTMERGE] Simplified ``FauxFactory`` class definition.

    This pull requests proposes to simplify the definition of the FauxFactory class for backwards compatibility by looking into the module's own set of functions and individually adding them to the class using setaatr, and removing a long list of function definitions that were calling the newer set of functions.

    opened by omaciel 9
  • incompatible with Python 3

    incompatible with Python 3

    Fauxfactory appears to be incompatible with Python 3.

    Why do I say this? When executing one of the example lines of code displayed in the readme (FauxFactory.generate_alphanumeric()), I get an error stating name 'unicode' is not defined. This is probably because the application assumes that it is being run under Python 2. However, unicode support has been more fully integrated in Python 3, and the "unicode" function has been removed from the standard library.

    Here's some copy-pasta from my machine:

    Python 3.4.0 (default, Mar 17 2014, 23:20:09)·                                                                        
    [GCC 4.8.2 20140206 (prerelease)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from fauxfactory import FauxFactory
    >>> FauxFactory.generate_alphanumeric()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/fauxfactory/__init__.py", line 102, in generate_alphanumeric
        return unicode(output_string)
    NameError: name 'unicode' is not defined
    
    opened by Ichimonji10 8
  • generic method for all different types of unicode string gens

    generic method for all different types of unicode string gens

    We already have gen_cjk() and per pull #63 might have gen_cyrillic.

    If we wanted to, in the future, support other methods (Tamil, Telugu, etc.), we can see where this would get very cumbersome/duplicitous, very quickly.

    It might be good to have some generic function that takes any specific range and plugs it in, and then wrap that with a function specific to the unicode block you want to test.

    e.g., instead of

         codepoints = [random.randint(0x4E00, 0x9FCC) for _ in range(length)]
         try:
             # (undefined-variable) pylint:disable=E0602
             output = u''.join(unichr(codepoint) for codepoint in codepoints)
         except NameError:
             output = u''.join(chr(codepoint) for codepoint in codepoints)
         return _make_unicode(output)
    

    ...put this into a generate_unicode_range() function that can have codepoint values passed to it, and then use that inside a function for any desired unicode block...

    gen_bengali() gen_hebrew() gen_hiragana()

    Now, there is a sticky wicket in all this. Some character sets span multiple, non contiguous blocks. More details here:

    http://en.wikipedia.org/wiki/Unicode_block

    So really, we should be able to pass all desired blocks into a python list, and then either make a single range to rule them all, or simply the ability to choose a random character out of each block within the list.

    opened by cswiii 3
  • `generate_email` uses production domains

    `generate_email` uses production domains

    As described in RFC 2606, the IETF has reserved several domains for use within documentation and example code. The following top-level domains are reserved:

    • test
    • example
    • invalid
    • localhost

    Additionally, the following second-level domains are reserved:

    • example.com
    • example.net
    • example.org

    Method FauxFactory.generate_email should, by default, use these IETF-sanctioned domains.

    opened by Ichimonji10 3
Releases(v3.1.0)
Owner
Og Maciel
I'm the linchpin for a diverse team of Quality Engineers, solving problems that people haven’t predicted, seeing things people haven’t seen, connecting people.
Og Maciel
Automated tests for OKAY websites in Python (Selenium) - user friendly version

Okay Selenium Testy Aplikace určená k testování produkčních webů společnosti OKAY s.r.o. Závislosti K běhu aplikace je potřeba mít v počítači nainstal

Viktor Bem 0 Oct 1, 2022
Minimal example of how to use pytest with automated 'devops' style automated test runs

Pytest python example with automated testing This is a minimal viable example of pytest with an automated run of tests for every push/merge into the m

Karma Computing 2 Jan 2, 2022
Let your Python tests travel through time

FreezeGun: Let your Python tests travel through time FreezeGun is a library that allows your Python tests to travel through time by mocking the dateti

Steve Pulec 3.5k Dec 29, 2022
Given some test cases, this program automatically queries the oracle and tests your Cshanty compiler!

The Diviner A complement to The Oracle for compilers class. Given some test cases, this program automatically queries the oracle and tests your compil

Grant Holmes 2 Jan 29, 2022
Travel through time in your tests.

time-machine Travel through time in your tests. A quick example: import datetime as dt

Adam Johnson 373 Dec 27, 2022
Data-Driven Tests for Python Unittest

DDT (Data-Driven Tests) allows you to multiply one test case by running it with different test data, and make it appear as multiple test cases. Instal

null 424 Nov 28, 2022
Data App Performance Tests

Data App Performance Tests My hypothesis is that The different architectures of

Marc Skov Madsen 6 Dec 14, 2022
Faker is a Python package that generates fake data for you.

Faker is a Python package that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in yo

Daniele Faraglia 15.2k Jan 1, 2023
pytest splinter and selenium integration for anyone interested in browser interaction in tests

Splinter plugin for the pytest runner Install pytest-splinter pip install pytest-splinter Features The plugin provides a set of fixtures to use splin

pytest-dev 238 Nov 14, 2022
User-oriented Web UI browser tests in Python

Selene - User-oriented Web UI browser tests in Python (Selenide port) Main features: User-oriented API for Selenium Webdriver (code like speak common

Iakiv Kramarenko 575 Jan 2, 2023
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 2, 2023
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

Teemu 963 Dec 28, 2022
Selects tests affected by changed files. Continous test runner when used with pytest-watch.

This is a pytest plug-in which automatically selects and re-executes only tests affected by recent changes. How is this possible in dynamic language l

Tibor Arpas 614 Dec 30, 2022
Docker-based integration tests

Docker-based integration tests Description Simple pytest fixtures that help you write integration tests with Docker and docker-compose. Specify all ne

Avast 326 Dec 27, 2022
To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations

To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations, a lot of data has to be collected to ensure the variance of the tests. This respository was established to collect a lot of different test data and related test cases of different member states in a standardized manner. Each member state can generate a folder in this section.

null 160 Jul 25, 2022
Show surprise when tests are passing

pytest-pikachu pytest-pikachu prints ascii art of Surprised Pikachu when all tests pass. Installation $ pip install pytest-pikachu Usage Pass the --p

Charlie Hornsby 13 Apr 15, 2022
Django-google-optimize is a Django application designed to make running server side Google Optimize A/B tests easy.

Django-google-optimize Django-google-optimize is a Django application designed to make running Google Optimize A/B tests easy. Here is a tutorial on t

Adin Hodovic 39 Oct 25, 2022
Run ISP speed tests and save results

SpeedMon Automatically run periodic internet speed tests and save results to a variety of storage backends. Supported Backends InfluxDB v1 InfluxDB v2

Matthew Carey 9 May 8, 2022
Statistical tests for the sequential locality of graphs

Statistical tests for the sequential locality of graphs You can assess the statistical significance of the sequential locality of an adjacency matrix

null 2 Nov 23, 2021