test_run

Exécute les tests

📝 Syntaxe

  • status = test_run()

  • status = test_run([])

  • status = test_run('minimal_tests')

  • status = test_run('-stoponfail')

  • status = test_run(modules)

  • status = test_run(file_to_test)

  • status = test_run(modules, '-stoponfail')

  • status = test_run(file_to_test, '-stoponfail')

  • status = test_run(modules, option)

  • status = test_run(file_to_test, option)

  • status = test_run('minimal_tests', '-stoponfail')

  • status = test_run('minimal_tests', option)

  • status = test_run([], '-stoponfail')

  • status = test_run([], option)

  • status = test_run(modules, file_output)

  • status = test_run(file_to_test, file_output)

  • status = test_run([], file_output)

  • status = test_run(modules, option, xunitfile)

  • status = test_run(modules, '-stoponfail', xunitfile)

  • status = test_run(modules, option, xunitfile, '-stoponfail')

📥 Argument d'entrée

  • module_name - a string ou une cellule de chaînes : nom du module ou liste de modules.

  • file_to_test - une string ou une cellule de chaînes : fichier à tester ou liste de noms de fichiers.

  • options - une string ou une cellule de chaînes : options supportées 'all', 'all_tests', 'unitary_tests', 'nonreg_tests' ou 'benchs'.

  • xunitfile - une string : nom de fichier pour exporter les résultats en .xml ou .json compatible avec le format Xunit.

  • '-stoponfail' - une string : arrêter l'exécution des tests à la première erreur détectée.

📤 Argument de sortie

  • status - un logique : vrai si les tests passent.

📄 Description

testrun recherche les fichiers 'test_.m', 'bug__.m' et 'bench_*.m', les exécute et affiche un rapport sur les succès ou les échecs.

Chaque test ou bench est exécuté dans un processus séparé en utilisant la commande 'unix'.

Cela permet à la commande courante de continuer, même si le test a créé un environnement instable.

Cela permet également aux tests d'être indépendants les uns des autres.

Certains tags spéciaux peuvent être insérés dans les fichiers .m pour aider au traitement du test correspondant.

Ces tags doivent être trouvés dans les commentaires Nelson :

<--NOT FIXED--> This test is skipped because it is a reported bug, but it is not yet fixed.

<--INTERACTIVE TEST--> This test is skipped because it is interactive test.

<--CLI MODE--> This test will be executed by nelson-cli executable (default).

<--ADV-CLI MODE--> This test will be executed by nelson-adv-cli executable.

<--GUI MODE--> This test will be executed by nelson-gui executable.

<--CHECK REF--> This test will compare .ref available in same directory with output generated. see test_makeref to generate .ref file.

<--ENGLISH IMPOSED--> This test will be executed with the fr_FR language.

<--WINDOWS ONLY--> This test will be executed only on Windows.

<--MACOS ONLY--> This test will be executed only on Macos.

<--UNIX ONLY--> This test will be executed only on Unix.

<--WITH DISPLAY--> This test will be executed only if a display output is available.

<--RELEASE ONLY--> This test will be executed only if nelson is an release (not in debug mode).

<--EXCEL REQUIRED--> This test will be executed only if excel is detected (on Windows).

<--MPI MODE--> This test will be executed in MPI mode.

<--AUDIO INPUT REQUIRED--> This test will be executed if an audio input is available.

<--AUDIO OUTPUT REQUIRED--> This test will be executed if an audio output is available.

<--C/C++ COMPILER REQUIRED--> This test will be executed if an C/C++ compiler is available.

<--INDEX 64 BIT REQUIRED--> This test will be executed if 64 bit index is available.

<--NO USER MODULES--> This test will be executed without load user modules.

<--IPC REQUIRED--> This test will be executed if IPC is available.

<--SEQUENTIAL TEST REQUIRED--> This test will be executed sequentialy (1 worker).

<--NATIVE ARCHITECTURE TEST REQUIRED--> This test will be executed if application's build and architecture are same.

<--FILE WATCHER REQUIRED--> This test will be executed if file watcher is available.

<--PYTHON ENVIRONMENT REQUIRED--> This test will be executed if python environment is available and configured.

<--JULIA ENVIRONMENT REQUIRED--> This test will be executed if julia environment is available and configured.

Les tests peuvent également être sautés dynamiquement en utilisant la fonction skip_testsuite.

Pour éviter de bloquer l'application, les tests ont un temps d'exécution de 2 minutes et les benchs ont un temps de 6 minutes.

test_run utilise n workers pour exécuter et accélérer l'exécution des tests.

Les tests avec <--SEQUENTIAL TEST REQUIRED--> sont évalués en dernier.

Les benchs sont évalués séquentiellement.

💡 Exemples

test_run('string');
test_run({'string', 'time'})
test_run({'string', 'time'}, 'all', [tempdir(), 'tests.xml'])

🔗 Voir aussi

assert, test_makeref, skip_testsuite.

🕔 Historique

Version
📄 Description

1.0.0

version initiale

1.3.0

PYTHON ENVIRONMENT REQUIRED tag added

1.4.0

skip_testsuite function reference

1.12.0

JULIA ENVIRONMENT REQUIRED tag added

Last updated

Was this helpful?