Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Video Transcript

Hello, this is Amir Shehata with another quick tip for the LUTF.

Let's get right into it and look at a simple "Hello Lustre" script.

First we can show the script like this:

Code Block
suites['samples'].scripts['sample_01.py'].show()

Each script must have a run()  function. That's what the LUTF executes.

So let's run it and see it in action:

Code Block
suites['samples'].scripts['sample_01.py'].run()

Now let's say we want to edit that script and change a couple of things and re-run it:

Code Block
suites['samples'].scripts['sample_01.py'].edit()

I use VIM as the default editor, but you can change that by doing:

Code Block
lutf.set_editor(<name as string>)
example:
lutf.set_editor("emacs")

You can then make whatever changes you want in edit mode. In this case, we'll just change what's being printed.

After you're done with the changes, save it and run it:

Code Block
suites['samples'].scripts['sample_01.py'].run()

There are a few things to note about the script:

The documentation block:

Code Block
"""
@PRIMARY: sample_01
@SECONDARY: sample_01
@DESCRIPTION: Simple Hello Lustre test
"""

It's enclosed in """ .

  • @PRIMARY: is the primary requirement this script fulfills
  • @SECONDARY: is the secondary requirement, if any, this script fulfills
  • @DESCRIPTION: Is a description of this test case

By specifying these the LUTF can generate automatic documentation for the test scripts. We no longer need to maintain a separate test plan. Our test scripts become our test plan.

One way of working would be to create a skeleton of the scripts which just include the above comment block. Then run the create_docs() command on the suite

Code Block
suites['samples'].create_docs("samples.csv")

This will generate a csv file with all the documentation.

This can then be imported directly into the Confluence wiki.

Let's run through this process to show how easy it is.

Advanced Tables - CSV Table
script^test.csv

Description of the YAML config file.

Mention that it can be generated automatically

Connect agent

...