* start papermill rollback * move reports to templates folder * comment some stuff * refactor reports controller * change var names * clean ctrl class vars * small refactoring on metadata search * relocate some func * breaking changes * revert some changes * destroying changes * change menu appearance * change menu appeaerance again * update choices * change some assets locations * remove unused vars * change some docstrings * rename vars * its working * forgot one dash * omg its working * clean some code and doc * change func name * fix a bug and add some comments * fix economy report startup * add custom reports * allow custom reports * forgot to delete this * unused import * make somestuff more explicit, 5 min rule * add helper func * supress errors--no-verify * add some type checks * fix check ipynb func * check inputs in run * rewrite some integration tests * remove unused import * add some docs to website * add auto completion * warn if no forecast * add to do * add arg name if 1 arg * add papermill pointing to github main * add notebooks * fix terminal spec * relocated choices files * merge main * relocate website docs for reports * limit user choices * fix portfolio auto completion * limit choices fix * clean som edocstrings * limit user choices in run command * improve run parser * fix msg * add reports controller tests * relax crypto choices limit * contain commands * pass pre commit * flake8 * flake8 * ignore mypy * pylint * website * move docs to jupyter tab * add installer dep * remove etf * remove reports * update reports to main * handle events erros * rever reports to previous commits before main merge * add papermill installer strategies * add flags to terminal * avoid sdk crash * execute notebook in thread * remove unused sys * execute report in a child process * fix some notebook stuff * fix portfolio report * fix reports controller volatility * change api to sdk * move images * remove som unucessary installer imports * remove debugger warning * move ipykernel launcher * supress notebook crash * remove portfolio decorator * fix run command * forgot to change this * add images * fix portfolio report * fix crypto report * linting and tests * add run integration test * pylint * hide reports module args * try at supressing args * try at supreccing warning * solve some os issues * handle pm errors * fix warning unrecognized arguments * change comment * avoid crash when parameters not found * fix etf commands * minor cleanup * update forecasting check * fix some linting * fix futures test * pylint * limit user choices to prompt * limit user choices to prompt * supress warnings * revert poetry lock back to main * papermill pointing to main * flake8 * forgot requirements * Update helper_funcs.py * Update reports_model.py * choices Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Simmons <53658028+simmonsj330@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.