* fixed integrated test test_stocks_ba.openbb * fixed integrated test test_stocks_dd.openbb * improved and centralised the check * fix lint * Docker : update ci + build files * Docker : update build and CD * Docker : update CD * Docker : test * Docker : test CD * Docker : test CD * Docker : rename `build.sh` * Docker : tests CD * Docker : test CD * Docker : update CD + build * Docker : fix CD * Docker : fix CD * Docker : build * Docker : test CD * Docker : CD * Docker : CD * Docker : test * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : build + CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : test CD * Docker : build * Docker : test CD * Docker : build + cd * Moving `scripts` * Checkout `helper_funcs.py` from main * Docker : remove test file with alpine * fixing readme errors * fixing missed readme errors * Docker : build * Logging : handle docker app name * Docker : test CD * Docker : cd * Doc * Doc * Doc : linting * Doc * Docker * Doc * Fixing `terminal_controller` * Linting * Doc : fixing links * Version 1.9.1 * Docker : fix name * Doc : add volumes in command Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Simmons <simmonsj330@gmail.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com>
OpenBB Terminal : Integration Testing
This document is part of the OpenBB Terminal library documentation.
It aims to provide necessary information in order to:
- Build
integration tests - Run
integration tests - Identify errors noted from
integration tests
1.1. Why having integration tests ?
The purpose of integration tests is to provide standard usage examples that can be programmatically run to make sure that a specific functionality of the terminal and the process to utilize that functionality is working properly.
2. How to build integration tests ?
Integration tests themselves are the same as manually running a certain series of steps. As a result, writing tests is easy because the integration test script is just the total list of steps necessary to use a command, command with specific argument, or series of commands.
When you contribute a new feature to the Terminal, it's important that integration tests are added for this particular feature. It is a part of the Checklist for the PR to be approved.
All the integration tests should be insides the scripts folder. The naming convention for scripts
should be test_<menu>_<command>.openbb if you are testing a specific command or test_<menu>.openbb
if you are testing the entire menu. However, it is encouraged to create as specific of integration tests
as possible to identify errors more precisely. Additionally, all tests must end with the exit command.
Examples
Testing a specific command and it's arguments:
script: test_alt_covid.openbb
- - - - - - - - - -
alternative
covid
country Australia
reset
slopes
country US
ov
country Russia
deaths
country United Kingdom
cases
country Canada
rates
exit
Testing an entire menu
test_stocks_options.openbb
- - - - - - - - - -
stocks
options
screen
view
view high_IV
set high_IV
scr
q
unu
calc
load aapl
exp 0
pcr
info
chains
oi
vol
voi
hist 100
grhist 100
plot -x ltd -y iv
parity
binom
load spy
vsurf
exit
3. How to run integration tests ?
Conda Terminal
After navigating to the location of the OpenBBTerminal repo, one can run integration tests in a few different ways using the wildcard expression.
-
Run all integration tests:
python terminal.py scripts/*.openbb -t -
Run some integration tests:
python terminal.py scripts/test_stocks_*.openbb -tThis specific example runs all of the stocks integration tests. One can use this same format for different tests.
-
Run one integration tests:
python terminal.py scripts/test_alt_covid.openbb -t
Installer Terminal
Integration tests can also be used on installers, which is a packaged version of the conda terminal. More information on how to build an installer can be found here.
-
Run all integration tests:
/Full/Path/To/OpenBB\ Terminal/.OpenBB/OpenBBTerminal /Full/Path/To/OpenBBTerminal/OpenBBTerminal/scripts/*.openbb -t -
Run some integration tests:
/Full/Path/To/OpenBB\ Terminal/.OpenBB/OpenBBTerminal /Full/Path/To/OpenBBTerminal/OpenBBTerminal/scripts/test_stocks_*.openbb -t -
Run one integration tests:
/Full/Path/To/OpenBB\ Terminal/.OpenBB/OpenBBTerminal /Full/Path/To/OpenBBTerminal/OpenBBTerminal/scripts/test_alt_covid.openbb -t
The -t argument runs the integration tests in 'test' mode. It is effectively a 'quiet' mode where one
doesn't see the terminal in action. If one were to remove this argument, then the terminal and subsequent
steps will be seen running in real time.
4. Errors
If the -t argument is given, errors that occur during an integration test are shown after all the
selected tests have run. The specific script that has some type of failure occurring, the reason why
it failed, and a summary of all the integration tests that were run is printed. An example is as followed:
/scripts/test_stocks_ba.openbb: Implement enable_gui in a subclass
/scripts/test_stocks_disc.openbb: No tables found
/scripts/test_stocks_dps.openbb: No tables found
/scripts/test_stocks_scr.openbb: 429 Client Error: Too Many Requests for url: https://finviz.com/screener.ashx?v=111&s=ta_toplosers&ft=4&r=101
Summary: Successes: 55 Failures: 4
If the -t argument is not given, then the reason why a specific failure occurs within an integration
test is printed inline while the test is being run.
If there is an error, one can identify the command and or series of steps that causes it fairly easily.