Flask Web App Testing

adamnieto Neuron 2020, Neuron, Registered, Neuron 2021, Neuron 2022, Neuron 2023 Posts: 87 Neuron


I am reaching out to the Dataiku user community in regards to the web apps in Dataiku DSS. Does anyone know where I should be writing my test code and calling it as well? For instance, if I wanted to use pytest for testing my flask app.


Thank you for your help!



Best Answer

  • Sarina
    Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer Posts: 315 Dataiker
    Answer ✓

    Hey Adam,

    One option for testing your flask app using a test framework would be to:

    1. Convert your web app to a plugin for development testing. You can do this by clicking on Actions | Convert to Plugin from your Webapp.
    2. You can then set up a code editor like Atom or Sublime to develop and run test code for the plugin. There is an Academy course that you can register for that walks through this setup with the intention of creating test files: Plugin Development .

    The plugin can also be integrated with GitHub as described here: Git integration in the plugin editor. You would need to either download the plugin or push it to Git and work from there to run any created test code.

    Alternatively, if you have access to your DSS server, you can grab your python file and run your test code against the python Webapp code. If you do this, you should not store your test files within your data directory, and instead pull your python code out for testing. Your python Webapp code lives in DATA_DIR/config/projects/{PROJECT_NAME}/web_apps/{WEBAPP_ID}/backend.py




Setup Info
      Help me…