Python API Test files

Bernhard 74fece2f29 Add 90 seconds waiting time after users are creates, so that the E-Mail-Addresses get unblocked by Stats-Script. 5 years ago
.idea 77bb9408cd Updated auth_user_testserver and updated scripts for Linux and Windows 5 years ago
dist 6b44d25743 Database prod users and products 5 years ago
old 7a1eb985b7 postgres gone 5 years ago
.gitignore 6852e32733 created EXE-File for windows 5 years ago
1 983d97471a changed scripts on Linux 5 years ago
API_Calls.py 74fece2f29 Add 90 seconds waiting time after users are creates, so that the E-Mail-Addresses get unblocked by Stats-Script. 5 years ago
__init__.py c93614772e Initial commit 5 years ago
api_calls.exe.spec 77bb9408cd Updated auth_user_testserver and updated scripts for Linux and Windows 5 years ago
copy_from_pretest.cmd b89ff09659 Copy from Pretest-Server 5 years ago
copy_from_server.cmd affd6102b6 logreader bug fixes and updats 5 years ago
copy_from_sshrouter.cmd c5a4c78e00 Copy from SSH-Router 5 years ago
init.ini f35857ee21 correct filenames for test nginx in ini-file 5 years ago
init_nginx.ini 9ab49b34c0 Nginx-Init-File 5 years ago
init_test.ini f35857ee21 correct filenames for test nginx in ini-file 5 years ago
local_large.sh 983d97471a changed scripts on Linux 5 years ago
local_small.sh 983d97471a changed scripts on Linux 5 years ago
log_reporter.py e803538736 Add Nginx-Logic to Log_reporter 5 years ago
make.cmd c93614772e Initial commit 5 years ago
pp_all_big.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_complete_run.sh e9974b197d Corrected simple recycling 5 years ago
pp_init.ini 2c5a3eab91 Preproduction 5 years ago
pp_mysql.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_mysql_recycle.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_mysql_short.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_mysql_short_recycle.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_nginx_big.sh ed1b5ddd1f +x for pp-files 5 years ago
pp_re_big.sh ed1b5ddd1f +x for pp-files 5 years ago
readme.md 3e6f5161ec nginx-change 5 years ago
scanapp_delete_transaction_data.sql 883ec0be6d Delete all transaction data - Script and update to latest master data 5 years ago
scanapp_master_data.sql 883ec0be6d Delete all transaction data - Script and update to latest master data 5 years ago
test.db 75d630a8b4 Several cmd-Files and DB for regular growth test 5 years ago
test.jpg f2690b0bcc INI-File, Standard-Products and many other changes 5 years ago
test2.jpg f2690b0bcc INI-File, Standard-Products and many other changes 5 years ago
test_all_big.sh 983d97471a changed scripts on Linux 5 years ago
test_all_med.sh 152c720be6 more test scripts 5 years ago
test_complete_faster.sh 162fff752d Faster version of testcomplete 5 years ago
test_complete_run.sh 4818d306bb changed complete_run 5 years ago
test_med.sh 983d97471a changed scripts on Linux 5 years ago
test_nginx_0kb.sh 983d97471a changed scripts on Linux 5 years ago
test_nginx_100kb.sh 983d97471a changed scripts on Linux 5 years ago
test_nginx_10kb.sh 983d97471a changed scripts on Linux 5 years ago
test_nginx_big.sh e4ac72769f Nginx-Testfiles 5 years ago
test_re_big.sh c04ebf1397 slowly increasing load 5 years ago
test_re_med.sh 983d97471a changed scripts on Linux 5 years ago
test_re_small.sh 152c720be6 more test scripts 5 years ago
test_short.sh 629ff3b0f1 test-short 5 years ago
test_short_eu.sh 31cb27505e Test_Short_eu 5 years ago

readme.md

API-Tester for Earthsquad Drops APP

General functions:

  • Create random users and products
  • Simulate daily behaviour of existing users
  • Load-Test nginx-Server

Call Parameters and INI-File

In the ini-file (if none is given, system looks for init.ini) all parameters can be preset. If a specific ini-file shall be used use command line parameter --ini_file=.

All other command line parameters overwrite the settings in the INI-file. Let's assume you have users=10000 in the ini_file and you start the program using command line parameter --users=10, then the 10 from the command line will overwrite the 10000 from the INI-File. Same goes for all other parameters.

Most important parameters (server, users, products) are also defaulted in the program, so you could theoretically also run it with an emtpy init.ini (not sure why you would do that, but it should be possible)

Command line parameters are printed on every start of the program. If you want to just see the available parameters, call the program with an invalid option e.g. --invalid

A log is written for each start of the program. The log also shows while running, which API-Calls take how long (Average, min, max, last). The statistics is printed at the end of the written Log aswell. LogLevel 1, 2, 4 can be used to influence contents of logs written. Log on Stdout is always 2.

Create random users and products

Timestamp of the first call of the program is used to randomly create a base-number, that will be used for all usernames and EAN-Codes. The base-number is then concatenated with range(1000../) to form each individual EAN-Code and User-ID. (e.g. 2341231000...2341231999 for usernames and EAN-Codes).

The program flow in this mode (mode=allnew = default mode)

  • Create users: Method api_users.create_users()
  • Create Product: Function: f_full_recycle()
    • Create EAN
    • Create Product
    • Create BOM or not (depending on wheter a standard product was randomly chosen)
    • Upload picture (whether or not and which picture can be set in INI-File or via command line)
    • Recycle this product (so that each product has at least 1 entry in recycling)
  • Recycle random number of products (out of the previously created products) for each user. In the Logs: "Mass-Recycling of user"
  • Do some bulk-recycling activities

Simulate daily behaviour of existing users

Prerequisit: Download result of select email from auth_users as CSV-File into the path.

Mode for this call: --mode=recycling or mode=recycling in the INI-File

CSV-File + path (if not current dir) must be given as commandline parameter --csv, otherwise it won't work.

Will behave like a regular user of the App, flow as follows:

  • Recycle a random product
  • Do some bulk recycling

The random products are found by brute-forcing /products/{id} with random numbers until the count of --products= from command line was found. In case there are too many 404-messages, the system assumes an endless loop and quits. (better use smaller numbers of --products, e.g. 10 or so on a smaller database).

Load-Test nginx-Server

Requesting files from Server given by --server (or ini_file) and writing statistics about duration.

Other contents of the Repo

  • Make.cmd --> Create EXE-File for distribution to Windows-PCs without Python installed
  • The images test.jpg (3.2 MB) and test2.jpg (80kB)
  • Default *.sh-Files for Linux
  • DIST-Folder including *.CMD-Files for Windows (call to api_calls.exe instead of python API_calls.py in the *.SH-Files)