-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception during run UT with TestCaseSource #146
Comments
Can you show the testclass source that causes this exception? OpenCover.UI has unit tests to ensure discovery of tests work, so we might have missed your test scenario? |
Please: namespace ResultTest
{
[TestFixture]
public class TryParseNumericResult
{
public IEnumerable GetTestCases()
{
yield return
new TestCaseData(">50").SetName("Greater than 50")
.Returns(new Tuple<decimal?, ConditionType>(50, ConditionType.GREATER));
yield return
new TestCaseData("<50").SetName("Less than 50")
.Returns(new Tuple<decimal?, ConditionType>(50, ConditionType.LESS));
yield return
new TestCaseData("50").SetName("Equal to 50")
.Returns(new Tuple<decimal?, ConditionType>(50, ConditionType.EQUAL));
yield return
new TestCaseData("N50").SetName("Alphanumeric result result")
.Returns(new Tuple<decimal?, ConditionType>(null, null));
}
[Test]
[TestCaseSource("GetTestCases")]
public Tuple<decimal?, ConditionType> TestTryParseNumericResult(string value)
{
decimal? numericValue;
ConditionType conditionType;
Result.TryParseNumericResult(value, out numericValue, out conditionType);
return new Tuple<decimal?, ConditionType>(numericValue, conditionType);
}
}
} Unfortunately I can't share all test dependencies. But test without corrections as shown above. |
See also #42 |
@comradum I implemented your testcode to try it, and it seems to work. Had to add a few methods that were missing from your post. this is the class I eventually had: ` namespace OpenCover.UI.TestDiscoverer.TestResources.NUnit
}` Ran this with the latest version of OpenCover and got this on screen: So, seems to work, unless your implementation of certain methods is different. Can you try with the latest build from github? |
Where I can found built binaries? Or I should build them myself? Also I have noticed that my problem already fixed, but I can't find any release with this problem fixed. |
@MelleKoning, I have release version 0.8.1 installed. I see that after release there were commits on master that can fix my problem. Are new release builds planned? If yes - when? |
Issue description:
Have exception: "Length cannot be less than zero" when start UT with TestCaseSource:
Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at OpenCover.UI.Processors.NUnitTestExecutor.ReadTestCase(XElement ts)
at OpenCover.UI.Processors.NUnitTestExecutor.b__1(XElement ts)
at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext() at System.Linq.Enumerable.<UnionIterator>d__66
1.MoveNext()at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__16
2.MoveNext()at System.Linq.Lookup
2.CreateForJoin(IEnumerable
1 source, Func2 keySelector, IEqualityComparer
1 comparer)at System.Linq.Enumerable.d__37
4.MoveNext() at OpenCover.UI.Processors.NUnitTestExecutor.UpdateTestMethodsExecution(IEnumerable
1 tests)at OpenCover.UI.Commands.ExecuteSelectedTestsCommand.b__1()
Versions used:
The text was updated successfully, but these errors were encountered: