Skip to main content

EvoMaster client for Python Flask RESTful applications

Project description

EvoMaster Client for Python

About EvoMaster:

EvoMaster is the first open-source AI-driven tool for automatically generating system-level test cases (also known as fuzzing) for web/enterprise applications. Currently targeting whitebox and blackbox testing of REST APIs.

Evomaster-Client for Python Flask

This library will let you integrate your Flask restful application to the EvoMaster core in order to automatically generate test cases for your API endpoints using the unittest testing framework for Python.

Quick Start

Installation:

pip3 install evomaster-client

After the installation, a CLI is available to be run from a Python environment to use the EvoMaster driver.

You can access the CLI help using:

python -m evomaster_client.cli -h

For now, the CLI supports two commands:

  1. run-instrumented
  2. run-em-handler

Running the instrumented version of your application:

python -m evomaster_client.cli run-instrumented [OPTIONS]

For example:

python -m evomaster_client.cli run-instrumented --package-prefix 'evomaster_benchmark.ncs' --flask-module 'evomaster_benchmark.ncs.app' --flask-app 'app' --instrumentation-level 2

where:

  • package-prefix is the prefix used to define the modules that will be instrumented
  • flask-module is the main module of your app
  • flask-module is the name of your Flask object defined in flask-module, used to start your app
  • instrumentation-level can be [0..2] where a higher value means the code instrumentation is richer

Running the EvoMaster handler to generate white-box tests for your application:

python -m evomaster_client.cli run-em-handler [OPTIONS]

For example:

python -m evomaster_client.cli run-em-handler --handler-module 'evomaster_benchmark.em_handlers.ncs' --handler-class 'EMHandler' --instrumentation-level 2

where:

  • handler-module is the module where the driver class, extending from FlaskHandler, was implemented
  • handler-class is name of the driver class defined in handler-module
  • flask-module is the name of your Flask object defined in flask-module, used to start your app
  • instrumentation-level can be [0..2] where a higher value means the code instrumentation is richer

Once you have the handler running, white-box tests can be generated using:

java -jar ../core/target/evomaster.jar --maxTime [time]  --outputFolder [path_to_tests] --outputFormat PYTHON_UNITTEST

Then you can run your generated tests using:

pip3 install unittest requests
python -m unittest [path_to_tests]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evomaster-client-0.0.8.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evomaster_client-0.0.8-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file evomaster-client-0.0.8.tar.gz.

File metadata

  • Download URL: evomaster-client-0.0.8.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.5

File hashes

Hashes for evomaster-client-0.0.8.tar.gz
Algorithm Hash digest
SHA256 ef9daadd3b21b411731f41080aba604d9efe3d304ffc007b919890f911a38b5e
MD5 b792bf3b911d4f902d9dadf899e1a7ea
BLAKE2b-256 416a10f887912885a2c36c64353769df67c2240703aaa1b29e6c10bb53385874

See more details on using hashes here.

File details

Details for the file evomaster_client-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for evomaster_client-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5df57f41b2f98abd25e61e9124b262c2673e66bde9325e7d7690ce830b9417ea
MD5 2c108a1efe1c06b0800ff03db173f8ef
BLAKE2b-256 a152698f55e4a53209374db5148eb0fa5192132e0a31d1c57322276bec1b32f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page