Git Product home page Git Product logo

case_drive_auto_tester's Introduction

说明

学习虫师 python web接口开发及测试 记录

中间用的命令

创建 guest 项目

django-admin startproject guest

创建 sign 项目

cd guest; python manage.py startapp sign

运行项目

python manage.py runserver [127.0.0.1:8000]

数据的迁移 migrate

-- 使用session 之后需要django 帮忙创建 django_session 表
python manage.py migrate

创建admin 后台的帐号

python manage.py createsuperuser

写过model 之后,进行数据库的创建

python manage.py makemigrations sign

python manage.py migrate

4.3 基本数据访问

python manage.py shell

>>> from sign.models import Event, Guest
>>> Event.objects.all()

-- select
>>> Event.objects.get(name='aaa').address

-- insert
>>> Event.objects.create()

-- like
>>> Event.objects.filter(name__contains='发布会')

-- delete
>>> Guest.objects.get(phone='13611001101').delete()

-- update
>>> g3=Guest.objects.get(phone='13611001101') >>> g3.realname='andy2'
>>> g3.save()

运行单元测试

-- 执行的是 sign/tests.py
python manage.py test

运行 sign 应用下的所有测试用例

python manage.py test sign

运行sign应用下的tests.py 测试文件

python manage.py test sign.tests

运行 sign 应用 tests.py 测试文件下的 ModelTest 测试类

python manage.py test sign.tests.ModelTest

执行 ModelTest 测试类下面的 test_event_models 测试方法(用例)

python manage.py test sign.tests.ModelTest.test_event_models

除此之外,我们还可以使用 -p (或 --pattern)参数模糊匹配测试文件

python manage.py test -p test*.py

case_drive_auto_tester's People

Contributors

mxgnene01 avatar

Watchers

 avatar  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.