Skip to content

简单的测试框架,用来测试IOT后端API,devOps模式的开发已经成为软件开发的主要方式,软件后端功能随着商业需求、商业逻辑的变化不断升级,因此必要的接口功能回归测试也需要更为频繁的进行。This is a project to enable the basic automated tests for the IOT based API functionality as you have a server on your local machine or remotely. Here, the test framework is built on a server template, powered and published by Directus, a complete suit…

License

Notifications You must be signed in to change notification settings

yancy-zh/testIotApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple framework for tests with IOT API

简单的测试框架,用来测试IOT后端API。 This is a project to enable the basic automated tests for the IOT based API functionality as you have a server on your local machine or remotely. 后端API包括以下功能: Here, the test framework is built on a server template, powered and published by Directus, a complete suite of API definition, endpoints and repository for a typical IOT ecosystem. The features presented in this software include both static and dynamic objects that are commonly used in the IOT oriented web services.

A simple framework for tests with IOT API

Prerequisites

一台测试服务器是用来作为客户端访问应用程序时,后台数据的存储和服务源,服务器需要正常运行,客户端才能进行访问,同时,在研发阶段,为测试应用的功能和性能,基本的测试环境需要有一台专门用来当服务器的电脑,它可以搭载windows或linux系统,通常通常我们选用装有Linux系统的旧笔记本电脑,因为它比较易于安装数据库软件的电脑(例如Apache),建议配置如下: Component Requirement

  • Processor 处理器 Server System Certification testing requires that the Server Under Test be populated w/ the maximum number of processors the system supports.
  • Memory 内存 Server System Certification testing requires that the Server Under Test be populated w/ the maximum amount of memory the system supports for the fastest clock speed supported by the system.
  • Disk space 硬盘空间 Minimum(最小): 10 GB Recommended(建议): 40 GB or greater
  • Note 注意 RAM容量超过16GB的电脑将需要更多的硬盘空间来进行休眠和缓存操作。Computers with more than 16 GB of RAM will require more disk space for paging, hibernation, and dump files
  • Drive DVD 光驱 DVD-ROM drive

network conditions

优势

建立自己的网络主机(webhost),创建一个静态网站,只需存储所用的html和数据文件。 To learn the full procedure of how the test of a project is established, refer to the article [https://www.webmasterworld.com/forum48/2432.htm] (https://www.webmasterworld.com/forum48/2432.htm)

明确使用场景

测试

背景

devOps模式的开发已经成为软件开发的主要方式,软件后端功能随着商业需求、商业逻辑的变化不断升级,因此必要的接口功能回归测试也需要更为频繁的进行。 The following instructions will get you a copy of the project up and running on your local machine for development and testing purposes. To acquire the basic environment for setting up a server that hosts websites and web apps, use LAMP stack. To install and test out the functions of this framework, a test server that includes the basic structure of Directus should be installed in advance. The test framework as well as the test cases presented in this repository, is based on Directus software and its database, so this template is only meaningful, functioning and necessary to be imported when Directus is installed.

LAMP stack

Since this Directus is just a sample server as the other web applications running as a virtual host, it depends on the basic server environment. Typically, a LAMP stack, which is a standard combination of open-source software, is used for setting up this host environment. This group of basic server related components, are commonly referring to:

The best way to setup the environment is to follow the official instruction provided on Directus documentation pages, where four methods for installing Directus are described. As a result, you will obtain a local copy of Directus (API and its databases). I personally have followed the installation instruction using Git to set up my Directus virtual host. Besides, the most helpful, illustrative and well organized resources that I found and used are

Directus

The information needs to be read is mainly the official website of Directus, the Directus Github respository and the documentation regarding this software suite.

For installation, use instructions listed under Installation page and trouble shooting page. The community also contains abundant tricks and solutions that are helpful for installation.

For understand the available API definition and endpoints, use the API reference.

Python 3

Python 3 is used when this project is constructed. This project requires the following packages to be installed:

  • requests
  • unittest
  • json
  • datetime

Python 3 can be acquired at the official website, download page. To check which packages have already been installed in your python 3 environment, you can run the following command in your shell or powershell terminal:

python3 freeze

Verification of the installation for dependencies

As a validation of the above mentioned Prerequisites having been satisfied, you should be able to see

  • A url pointing to the virtual host on your local machine, if the server is. For example, if typing the address:
localhost

you should see the installation page:

localhost/admin/#/install/

installation_page_of_directus_project

  • A virtual host named 'directus' is established, which appears as a directory with the same name in the domain management folder '/var/www/' in Linux system. In the directory 'directus', folders such as 'src', 'bin', 'config' should show.

  • After a Directus project is created, when accessing the IP of your local host, which is usually http://HOST_IP, the apache server will be redirecting you to the Directus application login page 'http://HOST_IP/admin/#/login' login_page_of_directus_project

  • A project in Directus which you can login with the admin user you have defined

  • The python 3 environment with packages listed in Prerequisites and a Python IDE

Install the test framework for IOT API

  1. Clone the repository of this project to your local machine.
  2. Modify the configuration file located in '/config' directory. It should contain the authentication information, project name as well as the HOST_IP of your test server.
  3. It should be noted that, the dummy information that are shared by multiple test cases, can be defined as a test base and should be listed in the configuration file, such as fake collection IDs, fake user names.

Running the tests

If unit tests are used for running the tests, use the module name for the configuration file.

Author

Acknowledgments

  • Directus

About

简单的测试框架,用来测试IOT后端API,devOps模式的开发已经成为软件开发的主要方式,软件后端功能随着商业需求、商业逻辑的变化不断升级,因此必要的接口功能回归测试也需要更为频繁的进行。This is a project to enable the basic automated tests for the IOT based API functionality as you have a server on your local machine or remotely. Here, the test framework is built on a server template, powered and published by Directus, a complete suit…

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages