Getting Started Guide of UnitFL 1 OverviewUnitFL is unit testing extension of Visual Studio. It has three main functions. • NUnit 3.0 Testing Adapter UnitFL implements a NUnit 3.0 testing adapter. You can write unit tests with NUnit 3.0 and run those tests in Test Explorer. • Coverage Tool You can choose to collect coverage informaiton while running unit tests. UnitFL will display them in a tool window. • Fault Localization Tool With coverage information and test results, UnitFL tries to locate the fault that is causing the failure. UnitFL displays suspicious program entites in a tool window. You can click those entites to navigate to the corresponding source code. 2 UnitFL as A Testing AdapterUnitFL currently only works with NUnit 3.0. Currently NUnit 3.0 is under prerelease, so to install it you need to include prerelease when you search NUnit in the NuGet package manager (see Fig 1). After building the assembly that contains NUnit tests, UnitFL will display them in the Test Explorer (see Fig 2). You can run the tests in the Explorer.
Figure 1: Downloading Nunit 3.0
Figure 2: Test Explorer 3 UnitFL as A Coverage ToolTo collect coverage, you need to open the UnitFL result window from View −> Other Windows −> UnitFL Result (see Fig 3). You need to toggle a button to enable profiling (see Fig 4). Now UnitFL will collect coverage information for tests. Collecting coverage costs a significant overhead, so you should toggle the button again to disable profiling when you don’t need coverage.
Figure 3: Open Result Window
Figure 4: Enable Profiling After running tests, coverage information will be displayed in the result window (see Fig 5). In the result window, you can click on a class or a method to navigate to the corresponding source code.
Figure 5: Coverage Result You can toggle a button to enable the coloration of the source code (see Fig 6). Uncovered lines will be marked red and covered lines will be marked green.
Figure 6: Enable Coloration 4 UnitFL as A Fault Localization ToolUnitFL can use test reuslts and coverage information to locate faults. To locate fault, you need to enable profiling first and change the combobox from Coverage to Fault Localization (see Fig 7).
Figure 7: Fault Localization After some of the tests failed, UnitFL will calculate the suspiciousness of every program entity and rank them in the result window (see Fig 8). There are five levels of suspiciousness and they are colored from red to green. Again you can navigate to the source code by click an item and you can toggle the coloration button to enable coloration of source code.
Figure 8: Fault Localization Result 5 FiltersYou can avoid the profiling some of your assemblies or classes using filters. Filters in UnitFL are very similar to those in OpenCover. Here are some examples: • +[*]*, -[*Tests]* Exclude those assemblies that end with Tests. • +[*Sample]* Only include those assemblies that end with Sample. • +[*]*, -[*]*Test Exclude those classes that end with Test. 6 Contact UsIf you have anything to say, please send a email to wangnangg@gmail.com. |