Skip to content

Examples

ThomasPRZilliox edited this page Feb 25, 2024 · 4 revisions

PyTest Examples

Example 1 - Plot

In that first example the Python script (using the pytest framework) will do the following:

  1. Check that the front most VI is "example 1 - plot.vi"
  2. Click on the button "Generate new plots"
  3. Store the new value of the graph
  4. Click again on the button "Generate new plots"
  5. Store the new value of the graph
  6. Compare the two values, the test is passed if they are different.

example 1 - plot

Example 2 - Value

In that second example the Python script (using the pytest framework) will do the following:

  1. Check that the front most VI is "example 2 - value.vi"
  2. Using the parametrized function of pytest, set a value to control labelled "myNumber"
  3. Then get the value of the control labelled "myNumber" and the boolean indicator "greater"
  4. If the boolean indicator "greater" si TRUE when "myNumber" is > 5, then the test is passed

example 2 - value

Example 3 - Subpanel

In that third example the Python script (using the pytest framework) will do the following:

  1. Check that the front most VI is "eaxample 3 - subpanel.vi"
  2. Click on the Sub Panel 1 control
  3. Check that the supbanel is displaying the appropriate VI (which is similar to example 1)
  4. Repeate the test of example 1
  5. Click on the Sub Panel 2 control
  6. Check that the supbanel is displaying the appropriate VI (which is similar to example 2)
  7. Repeate the test of example 2

example 3 - Subpanel

Clone this wiki locally