Skip to content
pip install picka - Picka is a python based data generation and randomization module which aims to increase coverage by increasing the amount of tests you _dont_ have to write by hand.
Branch: master
Clone or download
Latest commit 2693d5b Sep 1, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
picka Removing /data Sep 1, 2016
.gitignore Removed Breaking things out in to files still May 19, 2015
LICENSE Added license Aug 10, 2015
MANIFEST Added more canadian generators. May 5, 2015
readme.rst Removing /data Sep 1, 2016 I did something Sep 1, 2016


Picka: A Python module for data generation and randomization.

Author:Anthony Long
Version:1.0.1 - Fixed the broken image stuff. Whoops

What is Picka?

Picka generates randomized data for testing.

Data is generated both from a database of known good data (which is included), or by generating realistic data (valid), using string formatting (behind the scenes).

Picka has a function for any field you would need filled in. With selenium, something like would populate the "field-name-here" box for you, 100 times with random names.

for x in xrange(101):
        self.selenium.type('field-name-here', picka.male_name())

But this is just the beginning. Other ways to implement this, include using dicts:

user_information = {
        "first_name": picka.male_name(),
        "last_name": picka.last_name(),
        "email_address":, extension=''),
        "password": picka.password_numerical(6),

This would provide:

        "first_name": "Jack",
        "last_name": "Logan",
        "email_address": "",
        "password": "485444"

Don't forget, since all of the data is considered "clean" or valid - you can also use it to fill selects and other form fields with pre-defined values. For example, if you were to generate a state; picka.state() the result would be "Alabama". You can use this result to directly select a state in an address drop-down box.



def search_for_garbage():'')
        selenium.type('id=search_box', picka.random_string(10))

def test_search_for_garbage_results():
        assert selenium.get_xpath_count('id=results') == 0


driver = webdriver.Firefox()
x = {
        "name": [

Funcargs / pytest

def pytest_generate_tests(metafunc):
        if "test_string" in metafunc.funcargnames:
                for i in range(10):

def test_func(test_string):
        assert test_string.isalpha()
        assert len(test_string) == 20

MySQL / SQLite

first, last, age = picka.first_name(), picka.last_name(), picka.age()
   "insert into user_data (first_name, last_name, age) VALUES (?, ?, ?)",
   (first, last, age)


def post(host, data):
        http = httplib.HTTP(host)
        return http.send(data)

def test_post_result():
        post("www.spam.egg/bacon.htm", picka.random_string(10))
You can’t perform that action at this time.