phuccaoca123 / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Fix TD.Net bug with certain localized characters in report path #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Todo:

1. Unit tests to prove that it works.  The RunNamespace method looks
suspect to me right now.

2. Fix the filters.  Don't use string-based parsing for this, it produces
anbiguous results.  For example, RunMember should be using an
AndFilter<ITest> containing a TypeFilter<ITest> and MemberFilter<ITest> to
ensure that exactly the right member is selected.  There's no sense
unpacking this information into a potentially ambiguous string only to
rederive a filter specification from it.

3. Add a link to a generated HTML report.

Original issue reported on code.google.com by jeff.br...@gmail.com on 30 Aug 2007 at 7:14

GoogleCodeExporter commented 9 years ago

Original comment by jeff.br...@gmail.com on 30 Aug 2007 at 7:14

GoogleCodeExporter commented 9 years ago

Original comment by jeff.br...@gmail.com on 30 Aug 2007 at 7:30

GoogleCodeExporter commented 9 years ago
I updated the runner:

- Renamed TDDLogger to TDNetLogger.
- Implemented the filters right
- Added HTML report generation
- Added a link to the generated report
- Enhanced the integration with TD.NET by using the ITestListener.TestFinished 
method

So 2) and 3) are done. I also added some unit tests but they are really naive 
for now

Original comment by julian.h...@gmail.com on 31 Aug 2007 at 1:05

GoogleCodeExporter commented 9 years ago
I discovered that the ITestListener.TestFinished should be called after each 
method
is run, which made me re-design the way in which the add-in was informing the
progress. I had to create a new ITestRunnerMonitor implementation to call
TestFinished after each test finishes. With this implementation now:

- If you run one or more assemblies you'll see the number of tests that passed,
failed or were skipped, and also a navigable stack trace for the failing tests.

============================================================
------ Test started: Assembly: MbUnit.TestResources.MbUnit2.dll ------

TestCase 'IgnoredTests.IgnoredTest1' not executed: 

TestCase 'IgnoredTests.IgnoredTest2' not executed: 

TestCase 'SimpleTest.Fail' failed: 
    MbUnit.Core.Exceptions.AssertionException: Boom
    at MbUnit.Framework.Assert.Fail(String message)
    D:\Documents\Development\mbunit\v3\src\TestResources\MbUnit.TestResources.MbUnit2\SimpleTest.cs(32,0):
at MbUnit.TestResources.MbUnit2.SimpleTest.Fail()

TestCase 'FailingFixture.Fail' failed: 
    MbUnit.Core.Exceptions.AssertionException: Boom
    at MbUnit.Framework.Assert.Fail(String message)
    D:\Documents\Development\mbunit\v3\src\TestResources\MbUnit.TestResources.MbUnit2\FailingFixture.cs(34,0):
at MbUnit.TestResources.MbUnit2.FailingFixture.Fail()

7 passed, 2 failed, 2 skipped, took 7,80 seconds.
============================================================

- If you run a particular file or test, then you'll see an output like the 
following:

============================================================
------ Test started: Assembly: MbUnit.TestResources.MbUnit2.dll ------

MbUnit.AddIn.TDNet - Version 0.0 build 0

Test assemblies:
    D:\Documents\Development\mbunit\v3\src\TestResources\MbUnit.TestResources.MbUnit2\bin\MbUnit.TestResources.MbUnit2.DLL
Verifying assembly names.
Start time: 20:01
Loading test package.
Building test templates.
Building tests.
Running tests.
TestCase 'FailingFixture.Pass' passed [0 Asserts, Took 0 seconds]
TestCase 'FailingFixture.Fail' failed: 
    MbUnit.Core.Exceptions.AssertionException: Boom
    at MbUnit.Framework.Assert.Fail(String message)
    D:\Documents\Development\mbunit\v3\src\TestResources\MbUnit.TestResources.MbUnit2\FailingFixture.cs(34,0):
at MbUnit.TestResources.MbUnit2.FailingFixture.Fail()

Generating html report.
Stop time: 20:01 (Total execution time: 5,275 seconds)
TestResults:
file:///C:/Documents%20and%20Settings/jhi/Local%20Settings/Temp/MbUnit-TD-AddIn/
MbUnit.TestResources.MbUnit2.DLL.html

1 passed, 1 failed, 0 skipped, took 7,72 seconds.
============================================================

I also added lots of comments to the code, not really meant to public 
documentation
but targeted to understand the code and how the interaction with TD.NET works.
I added a few tests, mostly to call the RunMember method. There's also one that 
calls
the RunAssembly method. I don't really know what the RunNamespace method is 
supposed
to do, I've never seen it to be called, but I plan to add a tests for it anyway.

So this is almost done, we only need a few more tests and also to display the 
reason
when a tests is ignored.

Original comment by julian.h...@gmail.com on 3 Sep 2007 at 12:05

GoogleCodeExporter commented 9 years ago

Original comment by jeff.br...@gmail.com on 30 Oct 2007 at 2:20

GoogleCodeExporter commented 9 years ago
There's an issue when the report path contains characters like "ó". For 
example, in a
machine with a Spanish version of Windows I get a link like the following for 
the
generated report:

file:///C:/Documents%20and%20Settings/jhi/Configuraci%C3%B3n%20local/Temp/Gallio
.TDNetRunner/Gallio.TestResources.MbUnit2.DLL.html

For some reason this fails to open. I made some tests and it looks we should 
only
escape spaces:

file:///C:/Documents%20and%20Settings/jhi/Configuración%20local/Temp/Gallio.TDN
etRunner/Gallio.TestResources.MbUnit2.DLL.html

works pretty well. So I changed this line:

testListener.TestResultsUrl(uri.AbsoluteUri);

by this one:

testListener.TestResultsUrl("file:///" + uri.LocalPath.Replace(" ",
"%20").Replace(@"\", @"/"));

It's kind of a hack, but it works. I'd like to know if it works in other 
localized
versions of Windows though.

Original comment by julian.h...@gmail.com on 22 Nov 2007 at 10:44

GoogleCodeExporter commented 9 years ago
Updated the issue to reflect the remaining work on the bug described above.

Original comment by jeff.br...@gmail.com on 29 Nov 2007 at 12:40

GoogleCodeExporter commented 9 years ago
What you mean? I already uploaded the patch.

Original comment by julian.h...@gmail.com on 2 Dec 2007 at 10:57

GoogleCodeExporter commented 9 years ago

Original comment by julian.h...@gmail.com on 10 Jan 2008 at 10:21