Code Monkey home page Code Monkey logo

processingpy_unittest's Introduction

A unittest example for Processing.py

This is a single-file module and an example sketch to get Processing.py users started with simple unit testing and test-driven development (TDD) by adding a single tests.py file/tab.

Processing.py is Python Mode for Processing. It can be used to quickly wrap Python code together with the Processing Java API and distribute them as cross-platform sketches that run either as standalone apps or within the Processing IDE (PDE). Processing.py supports Python 2.7 running on the Jython 2.7 Python-on-Java interpreter. This includes the built-in unittest Unit Testing Framework.

This sketch demonstrates how to create and organize groups of unittest tests and run them from a sketch, for example through tests.run()

Getting Started

You can get started using unittest in Processing.py sketches by either:

  • downloading the example sketch and modifying it, or
  • adding the tests.py file to an existing Processing.py sketch and calling it with run() from the main sketch.

Prerequisites

If not already installed, you must:

  1. Download Processing 3.x
  2. In Processing, install Python Mode:
    • Processing > Tools > Add Tool > Modes > Python Mode

Using the example sketch

  1. Download or clone this repository.
  2. Launch the example in Processing by double-clicking using_unittest.pyde
  3. Modify tests.py to add tests.

Adding to an existing sketch

  1. Copy tests.py into the sketch folder, or create a new tab tests.py in PDE, and copy-paste the contents in.
  2. Modify tests.py to add tests.
  3. In the main sketch file/tab:
    • add import tests to the header
    • add tests.run() to setup() (or where appropriate)

Versioning

This project uses semantic versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Unlicense - see the LICENSE file for details.

Authors

Acknowledgments

processingpy_unittest's People

Contributors

jeremydouglass avatar

Stargazers

Alexandre B A Villares avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.