Skip to content

Commit

Permalink
report added to junit
Browse files Browse the repository at this point in the history
  • Loading branch information
ekhatko committed Apr 3, 2014
1 parent 7249cbf commit b7a4a7e
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 97 deletions.
50 changes: 25 additions & 25 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="url" value="https://user.visualstudio.com/DefaultCollection/" />
<add key="login" value="" />
<!-- following is password '123' encrpted-->
<add key="password" value="" />
<add key="project" value="" />
<add key="testplan" value="" />
<!-- proxy settings (OPTIONAL) -->
<add key="proxy_login" value="" />
<add key="proxy_password" value="" />
<add key="proxy_domain" value="" />
</appSettings>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="tfs_cli.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="url" value="http://ms-bssdev001.bee.vimpelcom.ru:8080/tfs/IT_SYSTEMS/" />
<add key="login" value="Ekhatko" />
<!-- following is password '123' encrpted-->
<add key="password" value="swiNjQLE2uWkZaQpf2D7ew==" />
<add key="project" value="CMD_ON" />
<add key="testplan" value="pilot" />
<!-- proxy settings (OPTIONAL) -->
<add key="proxy_login" value="" />
<add key="proxy_password" value="" />
<add key="proxy_domain" value="" />
</appSettings>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="tfs_cli.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
5 changes: 3 additions & 2 deletions CLAPOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ static void get_features(
static void junit_update(
[AliasesAttribute("r"), DescriptionAttribute("Junit report file"), RequiredAttribute] [FileExists]
string junit_report,
[AliasesAttribute("tp"), DefaultValue(""), DescriptionAttribute("Testplan to get tests from (overrides .config option)")] string testplan
[AliasesAttribute("tp"), DefaultValue(""), DescriptionAttribute("Testplan to get tests from (overrides .config option)")] string testplan,
[AliasesAttribute("ra"), DescriptionAttribute("Run attachment. E.g. overall run report")] [FileExists] string run_attachment
)
{
if (testplan != "")
_conData.setTestPlan(testplan);
JunitReportParser jrp = new JunitReportParser(junit_report);
JunitReportParser jrp = new JunitReportParser(junit_report, run_attachment);
IList<IRunResultProvider> RunResults = jrp.GetRunResults();
foreach (IRunResultProvider run in RunResults)
{
Expand Down
2 changes: 1 addition & 1 deletion FeatureWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override void WriteToOutput()
TfsCliHelper.Debug(string.Format("CopyFeaturesTo: \"{0}\"", _output));
foreach (var file in Directory.GetFiles(from))
File.Copy(file, Path.Combine(_output, Path.GetFileName(file)), true);
//Directory.Delete(from, true);
Directory.Delete(from, true);
}
catch (IOException e)
{
Expand Down
14 changes: 9 additions & 5 deletions JunitReportParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ class JunitReportParser
{
private XDocument _doc;
private Dictionary<IRunResultProvider, List<ITestResultProvider>> _runs = new Dictionary<IRunResultProvider, List<ITestResultProvider>>();
public JunitReportParser(string report)
public JunitReportParser(string report, string attach)
{
TfsCliHelper.Debug(string.Format("JunitParseFile: \"{0}\"", report));
_doc = XDocument.Load(report);
XElement ts = _doc.Root.Element("testsuite");
XElement ts = _doc.Element("testsuite");
//XElement root = _doc.Element("testsuite");
//XElement testsuite = root.Element("testsuite");
if (ts == null)
throw new Exception("Could not parse " + report);
string run_comment = String.Concat(ts.Attributes());
var testcases = _doc.Root.Element("testsuite").Elements("testcase");
var testcases = ts.Elements("testcase");
foreach (var testcase in testcases)
{
TfsCliHelper.Debug(string.Format("JunitParseTest: \"{0}\"", testcase.Name));
// parsing
string suite = testcase.Attribute("classname").Value;
string test = testcase.Attribute("name").Value;
string duration =(1000*(Math.Floor(double.Parse(testcase.Attribute("time").Value)))).ToString();
string duration =(1000*(Math.Floor(double.Parse(testcase.Attribute("time").Value.Replace('.',','))))).ToString();
bool failed = (testcase.Descendants("failure").Count() > 0);
string failure_message = "";
string outcome = (failed) ? "Failed" : "Passed";
Expand All @@ -36,7 +40,7 @@ public JunitReportParser(string report)
IRunResultProvider run = findRun(suite);
if (run == null)
{
run = new RunResultProvider(suite, "Autotest", "0", run_comment, report, suite);
run = new RunResultProvider(suite, "Autotest", "0", run_comment, attach, suite);
_runs[run] = new List<ITestResultProvider>();
_runs[run].Add(new TestResultProvider(test, outcome, suite, comment, null, "Unknown", failure_message, duration));
}
Expand Down
14 changes: 0 additions & 14 deletions bin/Release/tests.xml

This file was deleted.

Binary file modified bin/Release/tfs_cli.exe
Binary file not shown.
Binary file modified bin/Release/tfs_cli.pdb
Binary file not shown.
50 changes: 25 additions & 25 deletions bin/Release/tfs_cli.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="url" value="https://ekhatko.visualstudio.com/DefaultCollection/" />
<add key="login" value="[email protected]" />
<!-- following is password '123' encrpted-->
<add key="password" value="aYsKvHyDEQnoIuJ8Y1Qrfg==" />
<add key="project" value="cmd" />
<add key="testplan" value="bestplan" />
<!-- proxy settings (OPTIONAL) -->
<add key="proxy_login" value="Ekhatko" />
<add key="proxy_password" value="1Vimpelcom5!" />
<add key="proxy_domain" value="VIMPELCOM_MAIN" />
</appSettings>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="tfs_cli.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="url" value="http://ms-bssdev001.bee.vimpelcom.ru:8080/tfs/IT_SYSTEMS/" />
<add key="login" value="Ekhatko" />
<!-- following is password '123' encrpted-->
<add key="password" value="swiNjQLE2uWkZaQpf2D7ew==" />
<add key="project" value="CMD_ON" />
<add key="testplan" value="pilot" />
<!-- proxy settings (OPTIONAL) -->
<add key="proxy_login" value="" />
<add key="proxy_password" value="" />
<add key="proxy_domain" value="" />
</appSettings>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="tfs_cli.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
4 changes: 3 additions & 1 deletion tfs_cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
<Compile Include="TestsWriter.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions tfs_cli.userprefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
</Properties>
24 changes: 0 additions & 24 deletions tmp/TESTS-TestSuites.xml

This file was deleted.

0 comments on commit b7a4a7e

Please sign in to comment.