O'Reilly logo

Python Testing Cookbook by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Coding a data simulator

Coding a simulator that spits out data at a defined rate can help simulate real load.

This recipe assumes that the reader's machine is installed with MySQL.

Getting ready

  1. Make sure the MySQL production database server is up and running.
  2. Open a command line MySQL client shell as the root user.
  3. Create a database for this recipe called recipe63 as well as a user with permission to access it.
  4. Exit the shell.
    Getting ready

How to do it...

With these steps, we will explore coding a test simulator:

  1. Create a test generator script called recipe63.py that uses various Python libraries.
    import getopt import random import sys import time from network import ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required