OpenCover not working, it always shows 0% Code coverage - unit-testing

Visual Studio 2019 Community Edition
Project Framework 4.5
My Environment: Windows Server 2016
Expected Behavior: Expected to show code coverage as the covered percentage.
Actual Behavior: The Code coverage is always shown as 0
Command Used :
OpenCover.Console.exe -target:"<PATH>\xunit.runner.console.2.4.1\tools\net472\xunit.console.x86.exe" -targetargs:"<PATH>\bin\Debug\PROJECT_Tests.dll" -register:user -output:"<PATH>\bin\Debug\TestResults\OpenCover\coverage.xml"
I have tried the same with vstest runner also.
In cmd, the output is shown as :
=== TEST EXECUTION SUMMARY ===
PROJECT_Tests Total: 11, Errors: 0, Failed: 0, Skipped: 0, Time: 118.717s
Committing...
Visited Classes 235 of 1338 (17.56)
Visited Methods 942 of 17022 (5.53)
Visited Points 2632 of 58653 (4.49)
Visited Branches 1607 of 36315 (4.43)
==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 235 of 1570 (14.97)
Alternative Visited Methods 942 of 18541 (5.08)
But, when checking the coverage.xml file or using report generator (v4.5.0) we generate the report all the files are shown as 0% coverage.
<Method visited="false" cyclomaticComplexity="4" nPathComplexity="2" sequenceCoverage="0" branchCoverage="0" crapScore="20" isConstructor="false" isStatic="false" isGetter="false" isSetter="false">
<Summary numSequencePoints="8" visitedSequencePoints="0" numBranchPoints="3" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="4" minCyclomaticComplexity="4" maxCrapScore="20" minCrapScore="20" visitedClasses="0" numClasses="0" visitedMethods="0" numMethods="1" />
<MetadataToken>100664627</MetadataToken>
<Name>project.BusinessEntities.CoordinationNotes.CoordinationNotesInfo project.CoordinationNotes.DalCoordinationNotes::GetDetails(project.BusinessEntities.SystemManagement.GeneralRequest,project.BusinessEntities.Member.MemberTaskList&,System.Object&)</Name>
<FileRef uid="2505" />
<SequencePoints>
<SequencePoint vc="0" uspid="75974" ordinal="0" offset="0" sl="38" sc="9" el="38" ec="10" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75975" ordinal="1" offset="1" sl="39" sc="13" el="39" ec="131" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75976" ordinal="2" offset="44" sl="41" sc="20" el="41" ec="56" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75977" ordinal="3" offset="56" sl="42" sc="13" el="42" ec="14" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75978" ordinal="4" offset="57" sl="43" sc="17" el="43" ec="75" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75979" ordinal="5" offset="72" sl="45" sc="17" el="45" ec="115" bec="2" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75980" ordinal="6" offset="99" sl="47" sc="17" el="47" ec="29" bec="0" bev="0" fileid="2505" />
<SequencePoint vc="0" uspid="75981" ordinal="7" offset="114" sl="49" sc="9" el="49" ec="10" bec="0" bev="0" fileid="2505" />
</SequencePoints>
<BranchPoints>
<BranchPoint vc="0" uspid="75982" ordinal="0" offset="79" sl="45" path="0" offsetend="81" fileid="2505" />
<BranchPoint vc="0" uspid="75983" ordinal="1" offset="79" sl="45" path="1" offsetend="84" fileid="2505" />
</BranchPoints>
<MethodPoint xsi:type="SequencePoint" vc="0" uspid="75974" ordinal="0" offset="0" sl="38" sc="9" el="38" ec="10" bec="0" bev="0" fileid="2505" />
</Method>
Any suggestions? What am I doing wrong? Or any alternative for Code coverage in c# community Edition?

The issue was with the profiler. profiling was timing out after 60 seconds and not showing any error. More details can be found at : https://github.com/OpenCover/opencover/issues/728
The issue in filed in the latest release candidate v 4.7.1138.

Related

Camunda: How to get DMN to emit two variable/values to context of BPM workflow?

I want the two output values from DMN row, be sent to BPMN context, e.g DMN.output.var1=val1, DMN.output.var2=val2.
Input: (SPACE=LAW, THING=VANDALISM)
Output: (ROUT_TO_DEPT=BY_LAW, OUT_CATEGORY=INSPECTION)
These two variables must be in context, and available to next step in BPMN.
However I'm getting an error, how to make it happen?
DMN
Error
Stacktrace:
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-22002 The decision result mapper 'CollectEntriesDecisionResultMapper{}' failed to process '[{ROUT_TO_DEPT=Value 'BY_LAW' of type 'PrimitiveValueType[string]', isTransient=false, OUT_CATETORY=Value 'INSPECTION' of type 'PrimitiveValueType[string]', isTransient=false}]'. The decision outputs should only contains values for one output name but found '[ROUT_TO_DEPT, OUT_CATETORY]'.
at org.camunda.bpm.engine.impl.dmn.DecisionLogger.decisionResultCollectMappingException(DecisionLogger.java:44)
at org.camunda.bpm.engine.impl.dmn.result.CollectEntriesDecisionResultMapper.mapDecisionResult(CollectEntriesDecisionResultMapper.java:46)
at org.camunda.bpm.engine.impl.util.DecisionEvaluationUtil.evaluateDecision(DecisionEvaluationUtil.java:79)
at org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:56)
at org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:53)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.executeWithErrorPropagation(AbstractBpmnActivityBehavior.java:90)
at org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior.execute(DmnBusinessRuleTaskActivityBehavior.java:53)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute$2.callback(PvmAtomicOperationActivityExecute.java:61)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute$2.callback(PvmAtomicOperationActivityExecute.java:50)
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.continueIfExecutionDoesNotAffectNextOperation(PvmExecutionImpl.java:1996)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:42)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:31)
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128)
I tried to make it as resultList variable, however what I wanted is two output variables - a tuple.
Edit 1: If I choose "singleResult" option, I'm able to get it as a map in one single variable, however I want TWO varibles going to next STEP in a BPMN flow.
The mapping to resultList is used to map a list of rows with multiple output columns.
Switching to singleResult was the right direction. You are using a hit policy "First" (one rule/ row only), so the map decision result property can only be singleEntry (one output column) or singleResult (several output columns).
After mapping the decision result to a singleResult, you can use the Input/Output tab in the property panel to map the result entries to process variables:
In the text field of the output mapping you can use unified expression language, e.g. ${deptRoureDetail.get('ROUT_TO_DEPT')}
to access the result variable (in your case deptRoutDetail) of type Map and access the desired fields (ROUT_TO_DEPT, etc) by their keys.
Full example:
a) BPMN
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_17ij5vv" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:process id="Process_TwoOutputs" name="Two Outputs" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="customer" label="Customer" type="string" defaultValue="Miller" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:outgoing>SequenceFlow_1uzzene</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_1uzzene" sourceRef="StartEvent_1" targetRef="Task_EvaluteRules" />
<bpmn:businessRuleTask id="Task_EvaluteRules" name="Evalute Rules" camunda:resultVariable="result" camunda:decisionRef="Decision_twoOutputs" camunda:mapDecisionResult="singleResult">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:outputParameter name="blacklisted">${result.get('blacklistedCustomer')}</camunda:outputParameter>
<camunda:outputParameter name="pep">${result.get('pepCustomer')}</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1uzzene</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_10pcdah</bpmn:outgoing>
</bpmn:businessRuleTask>
<bpmn:sequenceFlow id="SequenceFlow_10pcdah" sourceRef="Task_EvaluteRules" targetRef="Task_00rrqy1" />
<bpmn:endEvent id="EndEvent_0f61xh5">
<bpmn:incoming>SequenceFlow_1fsnixe</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1fsnixe" sourceRef="Task_00rrqy1" targetRef="EndEvent_0f61xh5" />
<bpmn:scriptTask id="Task_00rrqy1" name="Print both variables" scriptFormat="javascript">
<bpmn:incoming>SequenceFlow_10pcdah</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1fsnixe</bpmn:outgoing>
<bpmn:script>print("blacklisted: " + blacklisted);
print("pep: " + pep);</bpmn:script>
</bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_TwoOutputs">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1uzzene_di" bpmnElement="SequenceFlow_1uzzene">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BusinessRuleTask_1oc25xp_di" bpmnElement="Task_EvaluteRules">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_10pcdah_di" bpmnElement="SequenceFlow_10pcdah">
<di:waypoint x="370" y="117" />
<di:waypoint x="430" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0f61xh5_di" bpmnElement="EndEvent_0f61xh5">
<dc:Bounds x="592" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1fsnixe_di" bpmnElement="SequenceFlow_1fsnixe">
<di:waypoint x="530" y="117" />
<di:waypoint x="592" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1xt3142_di" bpmnElement="Task_00rrqy1">
<dc:Bounds x="430" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
b) DMN
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/1.0" id="Definitions_0cib9be" name="DRD" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<decision id="Decision_twoOutputs" name="Two Outputs">
<extensionElements>
<biodi:bounds x="150" y="150" width="180" height="80" />
</extensionElements>
<decisionTable id="decisionTable_1">
<input id="input_1" label="Customer Name">
<inputExpression id="inputExpression_1" typeRef="string">
<text>customer</text>
</inputExpression>
</input>
<output id="output_1" label="blacklisted" name="blacklistedCustomer" typeRef="string" />
<output id="OutputClause_18xxjii" label="Politically Exposed Person" name="pepCustomer" typeRef="boolean" />
<rule id="DecisionRule_0qg0ni4">
<inputEntry id="UnaryTests_1i6rkew">
<text>"Miller"</text>
</inputEntry>
<outputEntry id="LiteralExpression_12xbrsq">
<text>"clear"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1obxdmm">
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_06aolv9">
<inputEntry id="UnaryTests_0oeomwy">
<text>"Smith"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1xobooq">
<text>"clear"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0sok0z4">
<text>true</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0ki09vh">
<inputEntry id="UnaryTests_096b0z2">
<text>"Jones"</text>
</inputEntry>
<outputEntry id="LiteralExpression_11x7v5h">
<text>"blacklisted"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1nit6ye">
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0tifgq8">
<inputEntry id="UnaryTests_0fqbez3">
<text>"Doe"</text>
</inputEntry>
<outputEntry id="LiteralExpression_0yghulu">
<text>"blacklisted"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1j2jmlj">
<text>true</text>
</outputEntry>
</rule>
</decisionTable>
</decision>
</definitions>
c) jUnit Test
import org.camunda.bpm.dmn.engine.DmnDecisionTableResult;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.variable.Variables;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.init;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.decisionService;
public class DMNUnitTest {
#Rule
public ProcessEngineRule rule = new ProcessEngineRule();
#Before
public void setup() {
init(rule.getProcessEngine());
}
#Test
#Deployment(resources = {"twoOutputs.dmn"})
public void testNoFlags() {
Map<String, Object> variables = Variables.createVariables().putValue("customer", "Miller");
DmnDecisionTableResult results = decisionService().evaluateDecisionTableByKey("Decision_twoOutputs", variables);
assertThat(results).hasSize(1);
assertThat(results.getSingleResult())
.contains(entry("blacklistedCustomer", "clear"))
.contains(entry("pepCustomer", false));
}
#Test
#Deployment(resources = {"twoOutputs.dmn", "twoOutputs.bpmn"})
public void testProcessWithtwoDecisionOutputs() {
Map<String, Object> variables = Variables.createVariables().putValue("customer", "Miller");
ProcessInstance pi = rule.getRuntimeService().startProcessInstanceByKey("Process_TwoOutputs", variables);
org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat(pi).hasVariables("blacklisted","pep");
}
}

How to list the two most recent folders inside a directory using their timestamp

I have a parent folder and inside that I have a few folders. For an automation, I want to take the latest of the two folders according to timestamp.
I have tried to take the latest folder by using timstampselector.
<timestampselector property="latest.modified">
<path>
<dirset dir="MyDirectoryPath">
<include name="*" />
</dirset>
</path>
</timestampselector>
Inside my parent folder, I have the following folders:
test (Last modified on 07/04/2019 10:30 AM)
check (Last modified on 08/04/2019 05:00 PM)
integrate (Last modified on 08/04/2019 12:30 PM)
slave (Last modified on 09/04/2019 05:00 PM)
Our script should take the latest two modified folders, which is in the above case it should be integrate & slave.
How can I achieve that?
Generally speaking, it's a good idea to stay away from ant-contrib whenever possible. This particular problem can be quickly solved with native Ant's resource collections:
<last count="2" id="latest.two.files">
<sort>
<date />
<fileset dir="MyDirectoryPath" />
</sort>
</last>
Full example target:
<target name="select-latest">
<delete dir="testdir" />
<mkdir dir="testdir" />
<touch file="testdir/test" datetime="07/04/2019 10:30 AM" />
<touch file="testdir/check" datetime="08/04/2019 05:00 PM" />
<touch file="testdir/integrate" datetime="08/04/2019 12:30 PM" />
<touch file="testdir/slave" datetime="09/04/2019 05:00 PM" />
<last count="2" id="latest.two.files">
<sort>
<date />
<fileset dir="testdir" />
</sort>
</last>
<echo message="${toString:latest.two.files}" />
</target>
The task you are using is part of Ant-Contrib rather than core Ant. The documentation says you can use the count attribute to say how many items you want to select. In your case, set it to two:
<timestampselector property="latest.modified" count="2">
<path>
<dirset dir="MyDirectoryPath">
<include name="*" />
</dirset>
</path>
</timestampselector>
This appeared to work fine for me: the property was set to a comma-separated list of two directories.

NUnit is not running my test cases

I have a test case that looks like:
namespace UnitTests
[<TestFixture>]
module ValidatorTests =
[<Test>]
let VerifyBasicFunctionality () =
Assert.That(bool)
Assert.That(bool)
and when I try to run it in the Visual Stuido test explorer, nothing happens (even with the Test Adapter for NUnit 3) and just says "Successful Build" and no tests discovered. Then when I run from the commandline with the nunit-console runner (tried with v.1, v.2, v.4) I get something different:
$ nunit-console4 bin/Release/UnitTests.dll
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 15.6.0.0
CLR Version: 4.0.30319.42000 ( 4.4.2 (Stable 4.4.2.11/f72fe45 Thu Aug 11 06:03:25 BST 2016) )
.N.N.N
Tests run: 0, Failures: 0, Not run: 3, Time: 0.011 seconds
When I run this with the -xmlConsole flag, I get this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This file represents the results of running a test suite-->
<test-results name="bin/Release/UnitTests.dll" total="0" failures="0" not-run="3" date="2016-09-08" time="10:26:00">
<environment nunit-version="2.4.8.0" clr-version="4.0.30319.42000" os-version="Unix 15.6.0.0" platform="Unix" cwd="/SOMEUSER/SOMEPATH/UnitTests" machine-name="gmaini-m.jet.local" user="SOMEUSER" user-domain="SOMELOCALBOX" />
<culture-info current-culture="en-US" current-uiculture="en-US" />
<test-suite name="bin/Release/UnitTests.dll" success="True" time="0.010" asserts="0">
<results>
<test-suite name="UnitTests" success="True" time="0.008" asserts="0">
<results>
<test-suite name="ValidatorTests" success="True" time="0.001" asserts="0">
<results>
<test-case name="UnitTests.ValidatorTests.VerifyBasicFunctionality" executed="False">
<reason>
<message><![CDATA[UnitTests.ValidatorTests is an abstract class]]></message>
</reason>
</test-case>
<test-case name="UnitTests.ValidatorTests.VerifyBasicOtherFunctionality" executed="False">
<reason>
<message><![CDATA[UnitTests.ValidatorTests is an abstract class]]></message>
</reason>
</test-case>
<test-case name="UnitTests.ValidatorTests.VerifyBasicSomeFunctionality" executed="False">
<reason>
<message><![CDATA[UnitTests.ValidatorTests is an abstract class]]></message>
</reason>
</test-case>
</results>
</test-suite>
</results>
</test-suite>
</results>
Any idea why it seems to discover the tests, I can dot access them with -run="Namespace.Module.Function" and talk about the fixture with -fixture="Namespace" but it won't run them? Is the UnitTests.ValidatorTests.VerifyBasicFunctionality is an abstract class a hint that there is some C# interop problem?
Thanks for your time :)
This fix was:
namespace UnitTests
[<TestFixtureAttribute>]
type ValidatorTests () =
[<Test>]
member __.VerifyBasicFunctionality() =
Assert.That(bool)
Assert.That(bool)
Basically, making this object oriented. So my hypothesis was correct.

Tracing to LogSource 'All Events' failed. Enterprise Library logging error

I am getting error. I am unable to understand what causing error. There are no exception on UI.
Category tables has values (Information,Exception,Debug,General). When all events failed error occurs there is no record entered into CategoryLog table. Can someone please help me to understand this error and to fix it.
Tracing to LogSource 'All Events' failed. Processing for other sources will continue.
See summary information below for more information. Should this problem persist,
stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks.
Summary for Enterprise Library Distributor Service:
====================================== -->
Message: Timestamp: 11/4/2014 9:35:46 PM
Message: 'Some message'.
WebConfig:-
<listeners>
<add name="DatabaseTraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=########"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#######"
databaseInstanceName="LoggingDatabase" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory"
formatter="Text Formatter"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#####"
template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="Error" name="Error">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</add>
<add switchValue="Information" name="Information">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</add>
<add switchValue="Warning" name="Warning">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</allEvents>
<notProcessed switchValue="All" name="Unprocessed Category">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</notProcessed>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</errors>
</specialSources>
Error record in log table looks like this
LogID: ######
EventID : 6352
Priority: -1
Severity: Error
Title :
Timestamp: 2014-11-10 00:55:51.770
MachineName : ########
AppDomainName: /LM/W3SVC/3/ROOT-######
ProcessID: 5272
ProcessName: c:\windows\system32\inetsrv\w3wp.exe
ThreadName: NULL
Win32ThreadId: 8852
Message :Tracing to LogSource 'All Events' failed. Processing for other sources will continue. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks. Summary for Enterprise Library Distributor Service:
====================================== --> Message: Timestamp:
FormattedMessage :
You are encountering an error logging to your database. But it seems that it is not totally catastrophic since it seems errors are being logged. This rules out a common cause such as invalid connection string.
You need to find out what the actual error is. To do this change the errors special source to log to a file (in a location with proper permissions). So add a flat file trace listener:
<listeners>
<add name="DatabaseTraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=########"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#######"
databaseInstanceName="LoggingDatabase" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory"
formatter="Text Formatter"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
<add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="trace.log" />
</listeners>
and then set the error special source to use the flat file trace listener:
<specialSources>
<allEvents switchValue="All" name="All Events">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</allEvents>
<notProcessed switchValue="All" name="Unprocessed Category">
<listeners>
<add name="DatabaseTraceListener" />
</listeners>
</notProcessed>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Flat File Trace Listener" />
</listeners>
</errors>
</specialSources>
With that setting you should hopefully see the full details of the error.
Making the user tries to write the log as admin is the solution for this problem. UAC setting can also be changed to make the IIS user as admin.

Trac won't parse google test xml output files

I have run the my unit tests written with the google test 1.6.0 framework with the --gtest_output="xml:test-results.xml" flag and get a test result file like this:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="8" failures="0" disabled="0" errors="0" time="81.396" name="AllTests">
<testsuite name="TestSuite1" tests="8" failures="0" disabled="0" errors="0" time="81.396">
<testcase name="Test1" status="run" time="6.391" classname="Class1" />
<testcase name="Test2" status="run" time="6.1" classname="Class1" />
<testcase name="Test3" status="run" time="7.146" classname="Class1" />
<testcase name="Test4" status="run" time="16.164" classname="Class1" />
<testcase name="Test5" status="run" time="25.145" classname="Class1" />
<testcase name="Test6" status="run" time="6.099" classname="Class1" />
<testcase name="Test7" status="run" time="6.162" classname="Class1" />
<testcase name="Test8" status="run" time="8.187" classname="Class1" />
</testsuite>
</testsuites>
Based on what I have read in other posts the gtest xml output is supposed to be compatible with junit parsers. Related Post: Unable to get hudson to parse JUnit test output XML
The other possibility of error is in my bitten script. Running on Trac 0.12.2. Here is my bitten recipe for parsing the XML file using the java:junit parser:
<build xmlns:java="http://bitten.edgewall.org/tools/java">
<step id="parse_results" description="Gather Results" onerror="fail">
<java:junit file="/home/user/temp/test-results.xml" />
</step>
</build>
In trac, it says that the build was successful, but the test results are blank. 0 run, 0 failed, 0 ignored, 0 errors
Thanks.
I was able to solve the problem. It turns out that Trac's JUnit parser has a bug. It doesn't like the testsuites tag and it doesn't like having multiple testsuite sections. PHP allows the testsuites tag, but will not do multiple files. I chose to create a parser in Python that creates multiple XML files from the Gtest output file.
def move_results(results, results_dir):
# Moves all results into a temp folder to be consumed by Bitten
# Files with multiple test suite sections, split into individual files
for files in results:
fin = open(files)
test_id = 0
split_line = files.split('/')
file_name = split_line[len(split_line)-1].split('.xml')
for line in fin:
if not 'testsuites' in line:
if '<testsuite ' in line:
output_file = results_dir + file_name[0] + '-' + str(test_id) + '.xml'
test_id = test_id + 1
fout = open(output_file, 'w')
fout.write('<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n')
fout.write(line)
elif '<testsuite\\>' in line:
fout.write(line)
fout.close()
elif not '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n' in line:
fout.write(line)
fin.close()
os.remove(files)
Alternatively, you could use Bitten to do convert using an XSLT. Also you could combine the output files into a single output (with something like nose's XUnit output) and use php:phpunit to parse the file.