Pawel Paluch
Top achievements
Rank 1
Pawel Paluch
asked on 13 Jun 2013, 03:57 PM
Hello,
similiary to Alexander in http://www.telerik.com/community/forums/justmock/general-discussions/justmock-dotcover-teamcity-problem.aspx thread i'm trying to make satup for unit test running nunit+justMock+dotcover, and i'm facing problems similiar to Alexander's, thus i created simple test as suggested in mentioned thread:
which results in following output:
similiary to Alexander in http://www.telerik.com/community/forums/justmock/general-discussions/justmock-dotcover-teamcity-problem.aspx thread i'm trying to make satup for unit test running nunit+justMock+dotcover, and i'm facing problems similiar to Alexander's, thus i created simple test as suggested in mentioned thread:
Assert.IsTrue(Mock.IsProfilerEnabled);
which results in following output:
[16:41:15][Step 6/7] NuSoft.Printer.Rs232.Tests.dll
[16:41:15][NuSoft.Printer.Rs232.Tests.dll] NuSoft.Printer.Rs232.Tests.PrinterTest.AssertStringPrinted
[16:41:15][NuSoft.Printer.Rs232.Tests.PrinterTest.AssertStringPrinted] Test(s) failed. Expected: True
But was: False
[16:41:15][NuSoft.Printer.Rs232.Tests.PrinterTest.AssertStringPrinted] Test(s) failed. Expected: True
But was: False
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.IsTrue(Boolean condition)
at NuSoft.Printer.Rs232.Tests.PrinterTest.CheckProfiler() in c:\TeamCity\buildAgent\work\64cb9cb36a4269ed\NuSoft.Printer.Rs232.Tests\PrinterTest.cs:line 18
at NuSoft.Printer.Rs232.Tests.PrinterTest.AssertStringPrinted() in c:\TeamCity\buildAgent\work\64cb9cb36a4269ed\NuSoft.Printer.Rs232.Tests\PrinterTest.cs:line 24
I followed manual http://www.telerik.com/help/justmock/integration-teamcity.html section Integrating JustMock within TeamCity using MS Test or NUnit build steps with dotCover and Profiler is linked to dotCover (the only one installed is the one bundled with TeamCity) and JUSTMOCK_INSTANCE=1 variable is present in build parameters.
tests run in VS2012, also when configured accordingly to Integrating JustMock within TeamCity using MS Test or NUnit build steps.
Telerik.JustMock - 2013.2.611.0
TeamCity - 7.1.5 (build 24400)
is there any thing that can be done in order to configure justmock to run on teamcity with nUint and dotCover?
8 Answers, 1 is accepted
0
Hello Pawel Paluch,
It is possible that, the JustMock profiler has been disabled (in this case Mock.IsProfilerEnabled will return "false" and so the test is expected to fail). To confirm this is not the issue and enable the profiler from a test, I would ask you to replace this test with a more appropriate one:
Let me know if this test is also failing inside your build process.
Thank you for the assistance in advance.
Regards,
Kaloyan
Telerik
It is possible that, the JustMock profiler has been disabled (in this case Mock.IsProfilerEnabled will return "false" and so the test is expected to fail). To confirm this is not the issue and enable the profiler from a test, I would ask you to replace this test with a more appropriate one:
[Test]
public
void
ShouldTestElevatedScenario()
{
// Arrange
var expected =
new
DateTime(2000, 12, 12);
Mock.Arrange(() => DateTime.Now).Returns(expected);
// Assert
Assert.AreEqual(expected, DateTime.Now);
}
Let me know if this test is also failing inside your build process.
Thank you for the assistance in advance.
Regards,
Kaloyan
Telerik
0
Pawel Paluch
Top achievements
Rank 1
answered on 21 Jun 2013, 08:18 PM
Hello,
result was "Test(s) failed. Telerik.JustMock.Core.ElevatedMockingException : Cannot mock 'System.DateTime'. The profiler must be enabled to mock, arrange or execute the specified target."
result was "Test(s) failed. Telerik.JustMock.Core.ElevatedMockingException : Cannot mock 'System.DateTime'. The profiler must be enabled to mock, arrange or execute the specified target."
0
Hello Pawel Paluch,
This is highly unfortunate.
Could you send us the logs from event with ID 1022 right after your build executes the JustMock tests? You can find them in the Windows Event Viewer, under Windows Logs > Application.
Thank you for the help and the understanding.
Regards,
Kaloyan
Telerik
This is highly unfortunate.
Could you send us the logs from event with ID 1022 right after your build executes the JustMock tests? You can find them in the Windows Event Viewer, under Windows Logs > Application.
Thank you for the help and the understanding.
Regards,
Kaloyan
Telerik
0
Pawel Paluch
Top achievements
Rank 1
answered on 24 Jun 2013, 09:53 AM
Hello,
there are no logs with 1022 ID.
Executed few builds with "Visual Studio (sln)" step and "NUnit" step,and nothing in application logs.
there are no logs with 1022 ID.
Executed few builds with "Visual Studio (sln)" step and "NUnit" step,and nothing in application logs.
0
Hello Pawel Paluch,
This is very strange. It means that both the JustMock and the dotCover profilers are not loading into your build process.
To help you further, I need to know if you can see any coverage results even with failed tests?
If the coverage is also missing, I will suggest to set up your build process in a way that runs dotCover and gathers coverage information. Then, try to link both the JustMock and dotCover profilers and check if the issue will remain.
Also, please make sure the JUSTMOCK_INSTANCE=1 is set as an environment variable (env.JUSTMOCK_INSTANCE=1).
Regards,
Kaloyan
Telerik
This is very strange. It means that both the JustMock and the dotCover profilers are not loading into your build process.
To help you further, I need to know if you can see any coverage results even with failed tests?
If the coverage is also missing, I will suggest to set up your build process in a way that runs dotCover and gathers coverage information. Then, try to link both the JustMock and dotCover profilers and check if the issue will remain.
Also, please make sure the JUSTMOCK_INSTANCE=1 is set as an environment variable (env.JUSTMOCK_INSTANCE=1).
Regards,
Kaloyan
Telerik
0
Pawel Paluch
Top achievements
Rank 1
answered on 02 Jul 2013, 09:17 AM
Hello,
indeed, while messing with project settings i had disabled dotCover:
when enabled, linked and with env.JUSTMOCK_INSTANCE=1
results with:
and avent with ID:1022 is Informational, stating:
indeed, while messing with project settings i had disabled dotCover:
when enabled, linked and with env.JUSTMOCK_INSTANCE=1
results with:
Test(s) failed. Telerik.JustMock.Core.ElevatedMockingException : Cannot mock 'System.DateTime'. The profiler must be enabled to mock, arrange or execute the specified target.
at Telerik.JustMock.Core.MocksRepository. (Type , IEnumerable`1 , IEnumerable`1 , IEnumerable`1 , Boolean )
at . . (MocksRepository , Type , Nullable`1 , Boolean )
at Telerik.JustMock.Core.MocksRepository. (Expression , )
at Telerik.JustMock.Core.MocksRepository.Arrange[ ](Expression , Func`1 )
at Telerik.JustMock.Mock. . ()
at . . [ ](Func`1 )
at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)
at NuSoft.Printer.Rs232.Tests.PrinterTest.CheckProfiler() in c:\TeamCity\buildAgent\work\64cb9cb36a4269ed\NuSoft.Printer.Rs232.Tests\PrinterTest.cs:line 19
at NuSoft.Printer.Rs232.Tests.PrinterTest.AssertStringPrinted() in c:\TeamCity\buildAgent\work\64cb9cb36a4269ed\NuSoft.Printer.Rs232.Tests\PrinterTest.cs:line 29
and avent with ID:1022 is Informational, stating:
.NET Runtime version 4.0.30319.17929 - The profiler was loaded successfully. Profiler CLSID: '{fe73d7a7-0cd1-49da-b89e-1c62cf1027b8}'. Process ID (decimal): 6720. Message ID: [0x2507]. |
0
Accepted
Hello Pawel,
It seems that the linking didn't work - apparently the core dotCover profiler got loaded instead of JustMock's. Linking with dotCover is done only for the current user account. Please, double-check that you're running the configuration tool from the same user account as the the account that later runs the build.
Regards,
Stefan
Telerik
It seems that the linking didn't work - apparently the core dotCover profiler got loaded instead of JustMock's. Linking with dotCover is done only for the current user account. Please, double-check that you're running the configuration tool from the same user account as the the account that later runs the build.
Regards,
Stefan
Telerik
0
Pawel Paluch
Top achievements
Rank 1
answered on 19 Aug 2013, 03:20 PM
Hello Stefan,
Aplologies for late answer, and yes ot worked. Thank you for assistance.
Regards
Paweł
Aplologies for late answer, and yes ot worked. Thank you for assistance.
Regards
Paweł