Skip to content

Commit

Permalink
feat: Add support for manual tests tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Feb 19, 2021
1 parent d1d2f05 commit 342b0d9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/articles/uno-development/working-with-the-samples-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ To add a new sample to the SamplesApp:
5. Double-check that the category name matches other samples for the control.
6. Run the `SamplesApp` to check that your sample appears in the browser and works as expected.

## Adding a manual test sample

Some tests cannot be validated automatically, and need to be flagged with the `IsManualTest` property on `SampleAttribute`. These tests will be filtered in the Samples App to be validated by a human.

The content of those tests must describe a scenario to follow, what to expect, and which exceptional conditions may need to be validated. If the result is visual, an image or video resource file may be needed as well.

## Sample snapshots on the CI

Each CI build of Uno.UI records screenshots of each sample in the SamplesApp. A diff tool details screenshots that have changed from the previous master build, allowing unexpected changes in the visual output to be caught.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ SampleChooserContent GetContent(TypeInfo type, SampleAttribute attribute)
ViewModelType = attribute.ViewModelType,
Description = attribute.Description,
ControlType = type.AsType(),
IgnoreInSnapshotTests = attribute.IgnoreInSnapshotTests
IgnoreInSnapshotTests = attribute.IgnoreInSnapshotTests,
IsManualTest = attribute.IsManualTest
};
}

Expand Down Expand Up @@ -846,7 +847,7 @@ public string GetAllSamplesNames()
{
var q = from category in _categories
from test in category.SamplesContent
where !test.IgnoreInSnapshotTests
where !test.IgnoreInSnapshotTests && !test.IsManualTest
select test.ControlType.FullName;

return string.Join(";", q.Distinct());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public partial class SampleChooserContent : INotifyPropertyChanged
public string[] Categories { get; set; }
public string Description { get; set; }
public bool IgnoreInSnapshotTests { get; internal set; }
public bool IsManualTest { get; internal set; }

bool _isFavorite;
public bool IsFavorite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ public sealed class SampleControlInfoAttribute : SampleAttribute
string controlName = null,
Type viewModelType = null,
bool ignoreInSnapshotTests = false,
bool isManualTest = false,
string description = null)
: base(category)
{
Name = controlName;
ViewModelType = viewModelType;
IgnoreInSnapshotTests = ignoreInSnapshotTests;
IsManualTest = isManualTest;
Description = description;
}

}

[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
Expand Down Expand Up @@ -71,6 +74,11 @@ public SampleAttribute(params Type[] categories)
/// </summary>
public bool IgnoreInSnapshotTests { get; set; }

/// <summary>
/// Determines if this test should be manually tested (e.g. animations, external/untestable dependencies)
/// </summary>
public bool IsManualTest { get; set; }

/// <summary>
/// An optional ViewModel type that will be instantiated and set as DataContext of the sample control
/// </summary>
Expand Down

0 comments on commit 342b0d9

Please sign in to comment.