Interface test automation framework - reudom

reuda

Automated testing framework based on requests and unittest interface.

Unittest-based interface and automated test framework of Requests

Introduction

Interface-based automated test library Unittest / Requests of

  • Provide scaffolding, the interface to quickly generate test automation project.
  • HTML automatically generated test report.
  • Example parameterized with the support.
  • Support heavy use cases failed to run
  • Requests for native API library lossless

Directory Structure

myreudom/
├── test_case/
│   ├── test_sample.py
├── reports/
└── run.py
  • test_dir/Catalog achieve write use cases.
  • reports/ Directory for test report generation.
  • run.py File run the test case.

Installation Tutorial

> pip install reudom

If you want to keep up with the latest version, you can install with github repository url:

> pip install -U git+https://github.com/SeldomQA/reudom.git@master

Create a project

>reudom --project myreudom

Run the project:

> reudom -r run.py
Python 3.7.1

                     _                 
                    | |                
  _ __ ___ _   _  __| | ___  _ __ ___  
 | '__/ _ | | | |/ _` |/ _ \| '_ ` _ \  | | | __| |_| | (_| | (_) | | | | | |  |_| \___|\__,_|\__,_|\___/|_| |_| |_|  --------------------------------------  @itest.info  generated html file:/Users/work/reports/2019_12_22_14_51_57_result.html .1

View Report

You can go to the  myreudom\reports\ directory view the test report.

reportsFolders can not themselves created, it automatically creates this folder when you execute run.py

simple demo

See the  demo/test_sample.py file

import reudom


class test(reudom.TestCase):
    def setUp(self): self.url = 'http://www.baidu.com' def test01(self): rep = reudom.request('get', url=self.url, headers=self.headers()) result = rep.json() self.assertEqual(result['status'], '200') if __name__ == '__main__': reudom.main("test_sample.py") 

Description:

  • Create a test class must inherit  reudom.TestCase.
  • Test case file must be named  test at the beginning.
  • reudom introduced post, get, head, patch, put, delete, optionsor the like.

main () method

reudom Import # ... IF the __name__ == '__main__ ': seldom.main ( path = "./ ", title = "Automation Interface test ", Description = "detailed test result: ", Debug = False, rerun, = 0 , save_last_run = False,)



Description:

  • path: test specified directory or file.
  • title: Specifies the test report title.
  • description: Specifies the test report describes.
  • debug: debug mode, set to True without generating test HTML test, by default False.
  • rerun: the failure to re-set the number of runs, by default  0.
  • save_last_run: Set saves only the last result, by default False.

Run the test

reudom Import 

reudom.main ( path = "./ ") # all current test files in the directory reudom.main ( path = "./test_dir/ ") all of the test files in the specified directory # reudom.main ( path = . " /test_dir/test_sample.py ") # test files in the specified directory reudom.main ( path = " test_sample.py ") # specifies the test file in the current directory

Description:

  • If the specified directory, test files must test begin with.
  • If you want to run the file in the subdirectory must be added in a subdirectory  __init__.py file.

Skip use case

reudom Import class YouTest ( reudom. TestCase): @ reudom.skip ( "skip this embodiment performs a ") DEF test_case ( Self): "" "A Simple Test Case " "" # ...




    

Used in PyCharm

  • When you use PyCharm compiler or other Python compiler, you only need to use pip install reudomafter installation created within the folder your project .pyfile import reudomon it
  • If you need a formal up and running, simply create the project with the directory run.pywhere the use of the above mainmethods you can take to run it; automatically at runtime run.pyof generating the same directory reportsfolder generated test report on the inside!

AES encryption

  • Now many of the projects use AES encryption interface transfer process, so I have to reudom library support
  • AES three most common kinds of programs _AES-128, AES-192 and AES-256, AES-128 but only the packaging scheme, will go after the remaining two kinds added to the list
  • All you need in your .py project in the introduction import reudom,
  • Then use:
    reudom.aesCrypt(
                    key='16位', 
                    model='加密模式', 
                    iv='CBC模式需要它', 
                    encode_='默认GBK')
                    .aesEncrypt('传入需要加密的明文')
  • key Incoming length must be: 16,24,32 bit
  • model Alternatively: ECB, CBC, CFB, PGP, OFB, CTR, OPENPGP seven modes which
  • iv CBC-passed using the same length of the key
  • encode_ Use the default encoding GBK
  • text Incoming need to encrypt the plaintext
import reudom

reudom.aesCrypt(key='1234567890123456', model='CBC', iv='1234567890123456', encode_='GBK').aesEncrypt(text='123') 控制台: /usr/bin/python3 /Users/yuanbaolei/work/GitHub/reudom/CryptoAESAES/Cipher/aesEncrypt.py 15tT+y0b+lJq2HIKUjsvvg== Process finished with exit code 0 

Thanks Mushishi! Reference projects seldom get ideas and help.

Author:

QQ:3165866425

Mail: [email protected]

blog: https://www.cnblogs.com/Barrybl/

Guess you like

Origin www.cnblogs.com/Barrybl/p/12094094.html