jeudi 26 novembre 2015

Robot Framework Test Case Generation from Within a Test Case?

I am using Robot Framework to automate onboard unit testing of a Linux based device.

The device has a directory /data/tests that contains a series of subdirectories, each subdirectory is a test module with 'run.sh' to be executed to run the unit test. For example :

/data/tests/module1/run.sh

/data/tests/module2/run.sh

I wrote a function that collects the subdirectory names in an array, and this is the list of test modules to be executed. The number of modules can vary daily.

@{modules}=     SSHLibrary.List Directories in Directory       /data/tests

Then another function (Module Test) that basically runs a FOR loop on the element list and executes the run.sh in each subdirectory, collects log data, and logs it to the log.html file.

The issue I am experiencing is that when the log.html file is created, there is one test case titled Module Test, and under the FOR loop, a 'var' entry for each element (test module). Under each 'var' entry are the results of the module execution.

Is it possible from within the FOR loop, to create a test case for each element and log results against it? Right now, if one of the modules / elements fails, I do not get accurate results, I still get a pass for the Module Test test case. I would like to log test cases Module 1, Module 2, ... , Module N, with logs and pass fail for each one. Given that the number of modules can vary from execution to execution, I cannot create static test cases, I need to be able to dynamically create the test cases once the number of modules has been determined for the test run.

Any input is greatly appreciated.

Thanks,

Dan.

Aucun commentaire:

Enregistrer un commentaire