public async Task GivenDataSourceForGroups_ShouldParseAllGroupItems() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_2.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 3); Assert.True(logParser.StageGroups[0].GroupStageNo == 1); Assert.False(logParser.StageGroups[0].IsStageFailure); Assert.True(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1); Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2); Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.SvnUpdate); Assert.True(logParser.StageGroups[1].GroupStageNo == 2); Assert.False(logParser.StageGroups[1].IsStageFailure); Assert.True(logParser.StageGroups[1].IsStageSuccess); Assert.True(logParser.StageGroups[1].IsStageCompleted); Assert.True(logParser.StageGroups[1].StageLineRange.Item1 == 3); Assert.True(logParser.StageGroups[1].StageLineRange.Item2 == 4); Assert.True(logParser.StageGroups[1].StageGroupType == StageGroupType.VerifyPackages); Assert.True(logParser.StageGroups[2].GroupStageNo == 3); Assert.False(logParser.StageGroups[2].IsStageFailure); Assert.True(logParser.StageGroups[2].IsStageSuccess); Assert.True(logParser.StageGroups[2].IsStageCompleted); Assert.True(logParser.StageGroups[2].StageLineRange.Item1 == 5); Assert.True(logParser.StageGroups[2].StageLineRange.Item2 == 6); Assert.True(logParser.StageGroups[2].StageGroupType == StageGroupType.CodeBuild); var(success, message) = logParser.GetStatement(); Assert.True(message == "Solution build failed: 0 failed project(s), 0 error instance(s)"); Assert.False(success); }
public async Task GivenDataSourceWithFailedVerifyPackage_ShouldParseGroupItemsAndCodeParse() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_5.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); Assert.True(logParser.StageGroups[0].GroupStageNo == 2); Assert.True(logParser.StageGroups[0].IsStageFailure); Assert.False(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.VerifyPackages); var(success, message) = logParser.GetStatement(); Assert.True(message == "1 error entries(s) found in stage - Verify Packages"); Assert.False(success); var results = logParser.VerifyPackageResults; Assert.NotNull(results); Assert.True(results.GetErrors().Count == 1); Assert.True(results.GetErrors()[0].Item1 == 2); Assert.True(results.GetErrors()[0].Item2 == " MSB4057: the target"); var timeTaken = logParser.GetStageTimeTaken(StageGroupType.VerifyPackages); Assert.True(timeTaken?.Hours == 1); }
public async Task GivenBlankPayload_ShouldGiveCorrectBuildStatement() { var logParser = new BuildLogParser("nonsense"); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 0); var(success, message) = logParser.GetStatement(); Assert.True(message == "No known build stages found in log"); Assert.False(success); }
public async Task GivenBuildCodePayload_ShouldParseCorrectly() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_7.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); var(success, message) = logParser.GetStatement(); Assert.True(message == "Solution build failed: 3 failed project(s), 13 error instance(s)"); Assert.False(success); var codeResults = logParser.CodeResults; Assert.True(codeResults.GetFailedProjectList().Count() == 3); }
public async Task GivenDataSourceForGroupsWithOneFailure_ShouldParseFailedGroupItems() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_3.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); Assert.True(logParser.StageGroups[0].GroupStageNo == 1); Assert.True(logParser.StageGroups[0].IsStageFailure); Assert.False(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1); Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2); var(success, message) = logParser.GetStatement(); Assert.True(message == "0 error entries(s) found in stage - SVN Update"); Assert.False(success); }
public Tuple <bool, string> GetBuildStatement() { return(buildLogParser != null?buildLogParser.GetStatement() : Tuple.Create(false, string.Empty)); }