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

Automating your management demo

Got a demo coming? Write automated tests that simulate the steps you'll be taking. Then print out your test suite, and use it like a script.

How to do it...

With these steps, we will see how to write our management demo script in a runnable fashion.

  1. Create a new file called recipe66.py to store the test code for our management demo.
  2. Create a unittest test scenario to capture your demo.
  3. Write a series of operations as if you were driving the application from this automated test.
  4. Include asserts at every point where you will vocally point out something during the demo.
    import unittest from network import * from springpython.database.factory import * class ManagementDemo(unittest.TestCase): def setUp(self): factory = MySQLConnectionFactory("user", ...

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