Bloggers have recently started to optimize the API Interface Automation framework, this time using the Django framework to complete
The first is the code for the Database model setup:
1 #-*-coding:utf-8-*-2 from __future__ Importunicode_literals3 fromDatetimeImportdatetime4 fromDjango.dbImportModels5 6 #Create your models here.7 8 9 #API Interface ClassificationTen classModule (models. Model): OneModule_name = models. Charfield (max_length=30) A - def __unicode__(self): - returnSelf.module_name the - - #API Interface Details - classMain (models. Model): +module =models. ForeignKey (Module) -Main_name = models. Charfield (max_length=30) +Main_url = models. Charfield (max_length=30) A at def __unicode__(self): - returnSelf.main_name - - - #API use case execution logging - classRecord (models. Model): inMain =models. ForeignKey (Main) -Record_name = models. Charfield (max_length=64) toRecord_user = models. Charfield (max_length=64) + #Auto_now_add=true for the first time, no update is created -Record_time = models. Datetimefield (auto_now_add=True) the * def __unicode__(self): $ returnSelf.record_namePanax Notoginseng - the #API Interface use case + classCase (models. Model): ARecord =models. ForeignKey (Record) theCase_name = models. Charfield (max_length=1024, null=True) +Case_doc = models. Charfield (max_length=1024, null=True) -ENV = models. TextField (null=True) $General_param = models. TextField (null=True) $Request_param = models. TextField (null=True) -Response_param = models. TextField (null=True) - the def __unicode__(self): - returnSelf.case_doc
Design ideas: Show the classification of the API, the following is each API interface, and then open is the interface under all the automated test case records, open the record can see all the use case details
The use case details here include the use case name, environment, public parameters, request parameters, return parameters, and the execution of the use cases have not been added
Django Framework Database model