The test run is aborted when a .testsettings is used for executing JustMock tests. The .testsettings contains only a description.
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Local" id="15694c75-be1c-4113-9d42-2cbe1013c41c" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
</TestSettings>
It seems that the usage of the MSTest element is breaking the execution.
Workaround: As .testsettings are deprecated use .runsettings instead without MSTest element.
Attempt to use JustMock VSTest v.2 task to run the elevated mode tests with coverage when the "Test platform version" option is set to value "Installed by Tools Installer" fails with error:
Telerik.JustMock.Core.ElevatedMockingException: Cannot mock '<target type goes here>'. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* {9317ae81-bcd8-47b7-aaa1-a28062e41c71} (from process environment)
Disable the profilers or link them from the JustMock configuration utility. Restart the test runner and, if necessary, Visual Studio after linking.
Update reference functionality wrongly suggests updating JustMock assembly reference and even more - detects currently referenced one as a lite version, see the screenshot below:
when using JustMock Free in a net 5.0 app. I am getting an Ninject exception that IAssemblyNameRetriever could not be found. Looking at the code on github,
the NETCORE compile constant removes the line
AddComponent<IAssemblyNameRetriever, AssemblyNameRetriever>();
from StandardKernel.cs
however, CompiledModuleLoaderPlugin uses IAssemblyNameRetriever in it's constructor and
AddComponent<IModuleLoaderPlugin, CompiledModuleLoaderPlugin>();
is still included in the NETCORE version.
Thread leak in JustMock
I am a member of the Visual Studio Perf Reliability team
Recently, I’ve found several customer dumps with huge # of threads.
In this dump:
Watson : Cab Search (microsoft.com)
Thd_ThreadStack_telerik_justmock_debugwindow_service_client!Telerik.JustMock.DebugWindow.Service.Client.ConnectionSetupServiceClientBase`[[System.__Canon,mscorlib]].get_ServiceAvailable
2,136,997,888
Progress® Telerik® JustMock Feedback Portal
There are 2084 threads using 2G mem, most with the stack below:
This is caused by threadpool starvation: the JustMock call ties up a thread for more than 1 second, then another request comes in.
The CLR will create an additional thread after 1 second to satisfy the request. This keeps happening and creates thousands of threads, each with size 1Meg.
00 ntdll!NtWaitForMultipleObjects
01 KERNELBASE!WaitForMultipleObjectsEx
02 clr!WaitForMultipleObjectsEx_SO_TOLERANT
03 clr!Thread::DoAppropriateAptStateWait
04 clr!Thread::DoAppropriateWaitWorker
05 clr!Thread::DoAppropriateWait
06 clr!SOIntolerantTransitionHandler::SetNoException
07 clr!CLREventBase::WaitEx
08 clr!CLREventBase::Wait
09 clr!AwareLock::EnterEpilogHelper
0a clr!ThreadDebugBlockingInfo::PopBlockingItem
0b clr!DebugBlockingItemHolder::{dtor}
0c clr!AwareLock::EnterEpilog
0d clr!AwareLock::Enter
0e clr!AwareLock::Contention
0f clr!JITutil_MonReliableContention
10 Telerik_JustMock_DebugWindow_Service_Client!Telerik.JustMock.DebugWindow.Service.Client.ConnectionSetupServiceClientBase<Telerik.JustMock.DebugWindow.Service.Proxy.TraceEventsSubscriptionServiceProxy>.get_ServiceAvailable
11 Telerik_JustMock_DebugWindow_Service_Client!Telerik.JustMock.DebugWindow.Service.Client.SessionServiceClientBase<Telerik.JustMock.DebugWindow.Service.Proxy.MockRepositorySubscriptionServiceProxy>.KeepAliveTimer_Elapsed
12 System_ni!System.Timers.Timer.MyTimerCallback
13 mscorlib_ni!System.Threading.TimerQueueTimer.CallCallbackInContext
14 mscorlib_ni!System.Threading.ExecutionContext.RunInternal
15 mscorlib_ni!System.Threading.ExecutionContext.Run
16 mscorlib_ni!System.Threading.TimerQueueTimer.CallCallback
17 mscorlib_ni!System.Threading.TimerQueueTimer.Fire
18 mscorlib_ni!System.Threading.TimerQueue.FireNextTimers
19 mscorlib_ni!System.Threading.TimerQueue.AppDomainTimerCallback
1a clr!CallDescrWorkerInternal
1b clr!CallDescrWorkerWithHandler
1c clr!MethodDescCallSite::CallTargetWorker
1d clr!MethodDescCallSite::Call
1e clr!AppDomainTimerCallback_Worker
1f clr!ManagedThreadBase_DispatchInner
20 clr!ManagedThreadBase_DispatchMiddle::__l16::Cleanup::{dtor}
21 clr!ManagedThreadBase_DispatchMiddle
22 clr!ManagedThreadBase_DispatchOuter
23 clr!ManagedThreadBase_FullTransitionWithAD
24 clr!ManagedThreadBase::ThreadPool
25 clr!AppDomainTimerCallback
26 clr!ThreadpoolMgr::AsyncTimerCallbackCompletion
27 clr!UnManagedPerAppDomainTPCount::DispatchWorkItem
28 clr!ThreadpoolMgr::ExecuteWorkRequest
29 clr!ThreadpoolMgr::WorkerThreadStart
2a clr!Thread::intermediateThreadProc
2b kernel32!BaseThreadInitThunk
2c ntdll!__RtlUserThreadStart
2d ntdll!_RtlUserThreadStart
Hi Team,
The main telerik.com site is blocked in Sweden. I spoke to my VPN provider and got the exit IP address (217.64.148.92).
They said that the IP address used to be listed as an Iran IP in older GEO IP databases, which would explain why https://telerik.com is not working, even though it is from Stockholm
Can you please double check that your GEO IP database is not listing the Swedish IP address as being in Iran?
Thank you,
Markus
http://tv.telerik.com/watch/telerik/test-drive-your-code-with-justmock
https://stackoverflow.com/questions/5755413/typemock-vs-justmock-vs-rhinomock-moq-current-situation-in-2011?rq=1
is in a lot of webpages that point to whats good about just mock, except this link is broken, can you put in a redirect to the actual vids for just mock.
I currently use typemock, but looking for a team solution and having broken links and missing content implies product abandonment.
Where can I find the links to the current vid on just mock?
Thanks
Doug
Using elevated mocking mode (profiler enabled) with long path names for the test containers (above 260 characters) causes the following command:
dotnet test
to fail with error:
Testhost process exited with error: Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(System.String[]) . Please check the diagnostic logs for more information. Test Run Aborted.
The following test fails:
[TestMethod]
public void TestCallOrderWithInOrder()
{
// Arrange
var mockClass1 = Mock.Create<Class1>();
var mockClass2 = Mock.Create<Class2>();
Mock.Arrange(() => mockClass1.Method1())
.InOrder();
Mock.Arrange(() => mockClass2.Method1())
.InOrder()
.Occurs(2);
Mock.Arrange(() => mockClass1.Method2())
.InOrder();
// Act
mockClass1.Method1();
mockClass2.Method1();
mockClass2.Method1(); // <--- this call is not allowed by
// InOrder clause currently
// and throws AssertFailedException
mockClass1.Method2();
// Assert
Mock.Assert(mockClass1);
Mock.Assert(mockClass2);
}
The documentation on Fluent Mocking ends with this statement:
Important
Note that when you use Fluent Asserts only arrangements marked with either MustBeCalled or Occurs will be verified. For other tests you have to use the explicit assert.
What this fails to note is that, while this is true of the function "Assert", there is another function, "AssertAll", which will flag an error if any Arranged function call was not utilized.
On a related note, I left other suggestions for this same page a day or two ago. I would have liked to leave the above statement using the same feedback utility, but I can no longer find the control that I used to leave those initial suggestions.
I filed a prior ThreadLeak:
Thread leak in JustMock (telerik.com)
I think I've found another one: (VS version 16.10.31321.278)
telerik_justmock_debugwindow_service_client!Telerik.JustMock.DebugWindow.Service.Client.ServiceHostMonitor.MonitorTimer_Elapsed
Apparently, the MonitorTimer_Elapsed code is running on a threadpool thread and it takes longer than 1 sec (perhaps it's waiting on a lock?).
Another timer tick occurs and the method is called again. Eventually, the ThreadPool runs out of threads and grows by about 1 thread per second (1Mb /sec leak)
In one dump 2Gig was used (1962 threads on the same MonitorTimer_Elapsed stack frame)
In that same dump there were 52 stacks with this frame:
telerik_justmock_debugwindow_service_client!Telerik.JustMock.DebugWindow.Service.Client.ConnectionSetupServiceClientBase`[[System.__Canon,mscorlib]].get_ServiceAvailable
(this was the same item as my prior report).
Implement a new public API that will allow the developer to iterate over all invocations of mock arrangements. Something like the following:
IEnumerable<IInvocaiton> invocations = Mock.Invocations;
The new public API should allow the developer to access the invocations for a particular arrangement. Something like the following:
IEnumerable<IInvocaiton> invocations = foo.GetInvocationsFor((x) => x.CalcData(2, 2));
Allow the developer to create custom behaviors and use them in an arrangement. Something like the following:
Mock.Arrange(() => foo.CalcData(Arg.AnyInt, Arg.AnyInt), new IBehavior[]
{
new LogInvocation(),
new ReturnBaseOrDefaultValue(),
});
The following test is not working anymore since version JustMock_2021_2_615_4 but was working with JustMock_2021_1_326_1 and older versions:
public interface ITest
{
void Test(string text);
}
[TestMethod]
public void MyTestMethod()
{
var mock = Mock.Create<ITest>();
Mock.Arrange(() => mock.Test("")).IgnoreArguments().OccursNever();
Mock.Arrange(() => mock.Test(Arg.Matches<string>(a => a == "a"))).InOrder().OccursOnce();
Mock.Arrange(() => mock.Test(Arg.Matches<string>(a => a == "b"))).InOrder().OccursOnce();
mock.Test("a");
mock.Test("b");
Mock.Assert(mock);
}
If I remove the OccorsNever line, its working.
If I remove the 2 InOrder, its working.
Seems that something change there: https://www.telerik.com/support/whats-new/justmock/release-history/justmock-r2-sp1-2021
I've already created an issue in the JustMock repo, you can find it here: https://github.com/telerik/JustMockLite/issues/162. Below is the text from that issue...
I'm currently working on a PR to add JustMock to the suite of performance tests that currently exist in that repository. The problem is that some of the tests (like OneParameter and Callback) take a long time to finish for JustMock. I'm not sure why, but it's making it such that JustMock can't be added to the test suite. More to the point, the PR can't be accepted as-is because it would take too long to finish.
One thing Steve (owner of the repo) and I talked about is if the invocationCount value passed to the SimpleJobAttribute (which exists on both the MockingBenchmark and MockingBenchmark<T> classes) is reduced from 100,000 to something like 1,000, the tests then finish, but that doesn't address the underlying issue why these tests for JustMock slow down over repeated called.
There may be something in the benchmark tests with the way I've set things up with JustMock that may be incorrect. I've never used JustMock until today :). If there's something that I'm doing right, please let me know.