Build/Test Issues

Duplicate test rows with conflicting states

Started by jnm236 on 5,474 views

I have NUnit tests with a number of parameterized test cases. NCrunch displays all the test cases in the Tests window underneath the test row, but then it duplicates five of them at the bottom and doesn't update the state. They say "Running (first time)" and "Pending, impacted" while the copy above says "Passed" or "Failed."

If I click on one, both rows show that they are selected. One of the duplicate rows cannot be selected at all.

Clicking "resync, rebuild and rerun" does not fix the problem, but clicking the visibility buttons (passed, failed, question mark and skipped) makes the duplicate rows disappear and everything is back to normal.
This keeps happening with different tests though, so I thought I'd report it.
Hi, thanks for sharing this issue.

Has NCrunch given you any warnings about the test cases having the same name? Are you able to share the code used to generate the tests? (Note that the content of the tests isn't relevant here, just the NUnit declarations used to create their names)
NCrunch has not given any warnings.

This is the code from the one that was just bothering me:


        public static IEnumerable<TestCaseData> AllGridControls() => 
            from type in typeof(BaseView).Assembly.GetTypes()
            where type.IsSubclassOf(typeof(Control)) && !type.IsAbstract
            from gridControlField in type.GetFieldsInHierarchy(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
            where typeof(GridControl).IsAssignableFrom(gridControlField.FieldType)
            select new TestCaseData(type, gridControlField)
                .SetNameParameters(type.Name, gridControlField.Name);

        [TestCaseSource(nameof(AllGridControls))]
        public void ConditionalFormattingIsValid(Type viewType, FieldInfo gridControlField)
        {
            // ...
        }


There's quite a bit going on there, but I verified just now that all TestCaseData.TestNames being returned are unique as I expect.
Thanks for sharing these extra details. I'm starting to think this might actually be a UI issue.

- Have you seen this happen for any tests in your suite that don't originate from TestCaseSource?

- Which grouping option are you using in the Tests Window?

- Does adjusting the sorting in the Tests Window have any impact on the problem?

- Can you submit a bug report after you've had this happen to you? The log may yield something useful.

Post a reply

Log in to reply.