Skip to content

Commit

Permalink
Improve DevEx
Browse files Browse the repository at this point in the history
Show docs on install
Restart labview after install to make project provider update

update docs
  • Loading branch information
antsundq committed Sep 16, 2024
1 parent 9105689 commit a582a2a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
23 changes: 15 additions & 8 deletions docs/10_Basics/Basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ To follow along with the instructions on this page you will need to have LabVIEW
All tests you write will belong to a test case.
The test case is implemented as a LabVIEW class, but in order to use it you will not need to know anything about object oriented programming.

To get started, create an empty project and add a test case to it from the ``Tools > LUnit > New Test Case...`` menu option.
To get started, create an empty project and add a test case to it by clicking the New Test Case button in the toolbar of the LabVIEW project.

![Project integration](img/project_Integration.png)

You can also do the same from the ``Tools > LUnit > New Test Case...`` menu option.

![Tools Menu > Lunit > new test case](img/tools_menu_new_tc.jpg)

Save the test case in a convenient location.
Some like to keep the tests next to the code they are testing, and other keep them in a separate folder called ``Tests`` or similar.
I personally find the later option with a separte top level directory the most convenient.
I personally find the later option with a separate top level directory the most convenient.

## Adding a Test Method

Expand All @@ -29,7 +33,7 @@ To create a new test method, right-click on the Test Static Test Method.vit and
![New from template](img/new_static_from_template.png)

You can create test methods any way you like and you are free to delete the template methods if you choose to.
It is important however that the connector pane uses the same pattern of terminals as the template and that the name starts with the word ``test``.
It is important however that the connector pane uses the same pattern of terminals as the template and that the name of the vi starts with the word ``test``.

You should now make your test method test something useful by implementing the block diagram of the vi.
To perform tests you will use the assertions available in the provided palette, or using quick drop.
Expand All @@ -39,25 +43,28 @@ To perform tests you will use the assertions available in the provided palette,
## Using Assertions

The result of each test is determined using assertions.
Thesere is a set of assertions to choose from as shown in the figure above and the names should be self explanatory.
There is a set of assertions to choose from, as shown in the figure above, and the names should be self explanatory.
One test method may contain multiple assertions and the result from each assertion will show up in the result view.

One pro-tip is that the ``Pass if Equal.vi`` assertion also works well for array data types.
The result of comparing arrays will show up in the result view as shown below.

![Comparing Arrays](img/array_comparison.jpg)

Please note that the ``Pass if Equal.vi`` assetion will fail if either the type or the value does not match.
Please note that the ``Pass if Equal.vi`` assertion will fail if either the type or the value does not match.

## Running the Test Case

To run the test case you can now right click it in the project window and select the ``Run Test Case...`` menu option.
You can run a single test vi (using the Run Arrow) and it will run and show the user interface with the results of the test.

To run all tests contained in a test case, you can right click it in the project window and select the ``Run Test Case...`` menu option.

![Run from right click menu](img/run_test_case.png)

This will open the test execution user interface and run the test case.
Alternatively you can also launch the user interface from the tools menu through the ``Tools > LUnit > LUnit UI...`` menu option.
This will open the user interface and show all tests in the current project.
As the test is run, the results are also shown as visual icons overlays in the project explorer.

![Run from right click menu](img/test_execution_ui.png)

Expand All @@ -76,7 +83,7 @@ It does make sense to organize tests in some manner, especially as the number of
There are many common practices around where to keep tests and how to organize the folder structure on disk.
In general it is useful to keep tests separated from the source, as there should be no dependency from the source on the test code.

While developing, it is convenient to keep the tests within the active LabVIEW project, as they may then be run quickly through the [project integration](#running-the-test-case) and you can run all the tests in the project throught the tools menu option.
While developing, it is convenient to keep the tests within the active LabVIEW project, as they may then be run quickly through the [project integration](#running-the-test-case) and you can run all the tests in the project through the tools menu option.
As test suites grow, it becomes less convenient as the test time accumulates with larger test suites and some of the tests might not be relevant to the feature under development.
While it is important to run the whole suite to catch regression issues, this does not have to be done as frequently as tests covering the new feature.

Expand All @@ -86,7 +93,7 @@ All tests within the test suite project may then be executed using the right cli

![Run nested project](img/run_nested_project.png)

When executing tests in a Continuous Integration environemnt, this test suite LabVIEW project file is a good entry point for running tests.
When executing tests in a Continuous Integration environment, this test suite LabVIEW project file is a good entry point for running tests.

In LUnit version 1.3.1, an additional feature was introduced to help speeding up test execution by skipping slow or unrelated tests.
A test method (`vi`) or entire test case class (`lvclass`) may be marked with an underscore `_` character as the first character, making it into a `dashed` test class or test case.
Expand Down
Binary file added docs/10_Basics/img/project_Integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions source/LUnit Framework.lvproj
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
<Item Name="Configuration Manager.lvclass" Type="LVClass" URL="../User Interface/Configuration Manager/Configuration Manager.lvclass"/>
<Item Name="Project Loader.lvclass" Type="LVClass" URL="../Support/Project Loader/Project Loader.lvclass"/>
<Item Name="Utilities.lvlib" Type="Library" URL="../Support/Utilities.lvlib"/>
<Item Name="Post-Install Custom Action.vi" Type="VI" URL="../Support/Post-Install Custom Action.vi"/>
</Item>
<Item Name="Project Providers" Type="Folder">
<Item Name="Project Provider.lvlib" Type="Library" URL="../Project Provider/Project Provider.lvlib"/>
Expand Down Expand Up @@ -886,7 +887,6 @@
<Item Name="Flip and Pad for Picture Control.vi" Type="VI" URL="/&lt;vilib&gt;/picture/bmp.llb/Flip and Pad for Picture Control.vi"/>
</Item>
<Item Name="lvanlys.dll" Type="Document" URL="/&lt;resource&gt;/lvanlys.dll"/>
<Item Name="DOMUserDefRef.dll" Type="Document" URL="/&lt;resource&gt;/DOMUserDefRef.dll"/>
<Item Name="Advapi32.dll" Type="Document" URL="Advapi32.dll">
<Property Name="NI.PreserveRelativePath" Type="Bool">true</Property>
</Item>
Expand Down Expand Up @@ -919,7 +919,7 @@
<Property Name="Bld_localDestDirType" Type="Str">relativeToCommon</Property>
<Property Name="Bld_previewCacheID" Type="Str">{86FCB19C-1FDD-419C-965A-93BB19BFAE86}</Property>
<Property Name="Bld_removeVIObj" Type="Int">1</Property>
<Property Name="Bld_version.build" Type="Int">30</Property>
<Property Name="Bld_version.build" Type="Int">31</Property>
<Property Name="Bld_version.major" Type="Int">1</Property>
<Property Name="Destination[0].destName" Type="Str">Destination Directory</Property>
<Property Name="Destination[0].path" Type="Path">../builds/LUnit</Property>
Expand Down Expand Up @@ -956,7 +956,7 @@
<Property Name="Destination[9].path" Type="Path">../builds/LUnit/examples/exbins</Property>
<Property Name="DestinationCount" Type="Int">15</Property>
<Property Name="Source[0].Container.applyDestination" Type="Bool">true</Property>
<Property Name="Source[0].itemID" Type="Str">{3D64D8D5-9329-4D15-8D04-4FC6DFE3718D}</Property>
<Property Name="Source[0].itemID" Type="Str">{3C6CD36C-98AB-4B4B-B5F4-1ED4A484459A}</Property>
<Property Name="Source[0].type" Type="Str">Container</Property>
<Property Name="Source[1].destinationIndex" Type="Int">8</Property>
<Property Name="Source[1].itemID" Type="Ref">/My Computer/Core/Result.lvlib</Property>
Expand Down
12 changes: 6 additions & 6 deletions source/LUnit.vipb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2021-03-25 19:33:33" Modified_Date="2024-06-09 14:07:04" Creator="Anton Sundqvist" Comments="" ID="b1e1a8fbfaae6ecc115b0eb80800db12">
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2021-03-25 19:33:33" Modified_Date="2024-09-14 21:25:14" Creator="Anton Sundqvist" Comments="" ID="c7df76e7b1ad2f76450e09079245a0d5">
<Library_General_Settings>
<Package_File_Name>Astemes_lib_LUnit</Package_File_Name>
<Library_Version>1.2.0.16</Library_Version>
Expand All @@ -21,7 +21,7 @@
<Pre-Build_VI/>
<Post-Build_VI/>
<Pre-Install_VI/>
<Post-Install_VI/>
<Post-Install_VI>..\builds\LUnit\vi.lib\Astemes\LUnit\LUnit Post-Install Custom Action.vi</Post-Install_VI>
<Pre-Uninstall_VI/>
<Post-Uninstall_VI/>
</Custom_Action_VIs>
Expand Down Expand Up @@ -246,7 +246,7 @@ Documentation is available on https://lunit.astemes.com.</Description>
</Install_Requirements>
<LabVIEW>
<close_labview_before_install>false</close_labview_before_install>
<restart_labview_after_install>false</restart_labview_after_install>
<restart_labview_after_install>true</restart_labview_after_install>
<skip_mass_compile_after_install>false</skip_mass_compile_after_install>
<install_into_global_environment>false</install_into_global_environment>
</LabVIEW>
Expand Down Expand Up @@ -432,7 +432,7 @@ Documentation is available on https://lunit.astemes.com.</Description>
<Path>..\builds\Advanced Assetions</Path>
<VI_Title/>
</Items_Data>
<GUID>6A28A3DA28FA5376C8CF9813C9A2701C</GUID>
<GUID>CF41AC2AF15472B867584522C24DE781</GUID>
</Functions_Palette_Data>
<Functions_Palette_Data>
<Parent_Palette_Index>0</Parent_Palette_Index>
Expand Down Expand Up @@ -467,7 +467,7 @@ Documentation is available on https://lunit.astemes.com.</Description>
<Path>..\builds\LUnit\vi.lib\Astemes\LUnit\Palette\API\LUnit Run Tests.vi</Path>
<VI_Title/>
</Items_Data>
<GUID>A2C4E9D70B8333BBC982F7E6867E1C8A</GUID>
<GUID>5B79AADE973F1BA150ED7C44DF0515A0</GUID>
</Functions_Palette_Data>
<Functions_Palette_Data>
<Parent_Palette_Index>0</Parent_Palette_Index>
Expand Down Expand Up @@ -572,7 +572,7 @@ Documentation is available on https://lunit.astemes.com.</Description>
<Path>..\builds\LUnit\vi.lib\Astemes\LUnit\Palette\Advanced Assertions\Pass If Matching String.vi</Path>
<VI_Title/>
</Items_Data>
<GUID>ADAD8638CD67C3AC23579FAFADF72F5A</GUID>
<GUID>9E0DD2D9ED002868FFE8A97AB419F05A</GUID>
</Functions_Palette_Data>
</Library_Palette_Definition>
</VI_Package_Builder_Settings>
Binary file added source/Support/Post-Install Custom Action.vi
Binary file not shown.

0 comments on commit a582a2a

Please sign in to comment.