Testing a Flask Application usin

作者: python测试开发 | 来源:发表于2019-05-09 22:49 被阅读8次

Introduction

I recently started using pytest and it is an incredible test framework for python! After reading Brian Okken’s book titled “Python Testing with pytest“, I was convinced that I wanted to start using pytest instead of the built-in unittest module that comes with python. In this blog post, I’ll explain how to test a Flask application using pytest.

pytest is a test framework for python that you use to write test cases, but also to run the test cases. After setting up your test structure, pytest makes it really easy to write tests and provides so much flexibility for running the tests. Using pytest, I’ve found that is satisfies the key aspects of a good test environment:

  • tests are fun to write
  • tests can be written quickly by using helper functions (fixtures)
  • tests can be executed with a single command
  • tests run quickly

For reference, the Flask application that is referenced in this blog post can be found on GitLab: https://gitlab.com/patkennedy79/flask_user_management_example

https://www.patricksoftwareblog.com/testing-a-flask-application-using-pytest/

相关文章

网友评论

    本文标题:Testing a Flask Application usin

    本文链接:https://www.haomeiwen.com/subject/dkyfnqtx.html