GuOrg / Gu.Wpf.UiAutomation

MIT License
96 stars 17 forks source link

Red tests #43

Closed FoggyFinder closed 6 years ago

FoggyFinder commented 6 years ago

There are a few of red tests on my machine:

_ui

some of them is obvious, but some is totally unexpected, does it correct behaviour?

JohanLarsson commented 6 years ago

What OS are you using? The tests are somewhat fragile but I've been struggling to get them to pass on win 7, win 10 & appveyor. It can be that longer waits are needed if you have a slow computer for example.

image Ran it on win 10 ^

Rerun it on appveyor and all tests passed.

We should try to figure out what is different on your machine and fix the lib so that they pass.

JohanLarsson commented 6 years ago

If you are adding a feature or fixing something you can go ahead and ignore if some unrelated test fails and we can try to solve it together in the PR or after merge.

FoggyFinder commented 6 years ago

Win7

Some of them fails because my machine has other localization, so, for example, here:

 var exception = Assert.Throws<UiAutomationException>(() => checkBox.IsChecked = null);
 Assert.AreEqual(
    "Setting AutomationId:SimpleCheckBox, Name:Test Checkbox, ControlType:check box, FrameworkId:WPF .IsChecked to null failed.",
    exception.Message);

according to

return $"AutomationId:{this.Properties.AutomationId.ValueOrDefault("MISSING")}, Name:{this.Properties.Name.ValueOrDefault("MISSING")}, ControlType:{this.Properties.LocalizedControlType.ValueOrDefault("MISSING")}, FrameworkId:{this.Properties.FrameworkId.ValueOrDefault("MISSING")}";```

returns флажок instead of check box

FoggyFinder commented 6 years ago

Some thoughts: 15/29 'pass for me after small changed in #45

Regarding remaining 14 red tests:


2/14

the reason in simple switch

 switch (CultureInfo.InstalledUICulture.TwoLetterISOLanguageName)
 {
    case "de": return ...
    default: return ...
}

so, someone who want to see green test have to add his locale to the list.


3/14

the same reason like group above except that there is no switch.


1/14

There is no explicit localization problem but I guess the reason the same.


7/ 14

Someone may have settings for changing text size by default for example by 125%. So Size will be different. If there any properties for getting the coefficient then the test could be green. But anyway I think this is a rare case so not very important.


1/14

I was mentioning about it in gitter. Perhaps make sense create separate issues for this.

JohanLarsson commented 6 years ago

Nice writeup, thanks for taking the time to do this!

JohanLarsson commented 6 years ago

Refactored things, maybe fixed some of these by accident, maybe broke things.

FoggyFinder commented 6 years ago

Can't run test now:

[03.01.2018 19:03:20 Warning] в Mono.Cecil.ModuleDefinition.ProcessDebugHeader() в Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader) в Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) в Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters) в Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters) в Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) в NUnit.VisualStudio.TestAdapter.NavigationDataProvider.CacheNewTypes(String assemblyPath, IDictionary`2 types) в NUnit.VisualStudio.TestAdapter.NavigationDataProvider.GetNavigationData(String className, String methodName) в NUnit.VisualStudio.TestAdapter.TestConverter.MakeTestCaseFromXmlNode(XmlNode testNode) в NUnit.VisualStudio.TestAdapter.TestConverter.ConvertTestCase(XmlNode testNode) в NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, TestFilter filter)

JohanLarsson commented 6 years ago

What is this hipster stack? Are you using Linux?

FoggyFinder commented 6 years ago

lol, no is was happening due to

https://github.com/nunit/nunit3-vs-adapter/issues/296

so works now.

I'm going to close this issue and open new if see something specific cause there a some new red test