chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
When I run my unit tests with Test driven.net all my tests run fine and GetCallCount returns the correct values for all mocked functions. However if I run my tests using nunt GetCallCount returns 0 for some of the mocked functions.

Does anyone have any suggestions.

Thanks in advance.
asked by (1.2k points)

6 Answers

0 votes
However if I run my tests using nunt GetCallCount returns 0 for some of the mocked functions.


Hi,
Are you running the NUnit thrught TMockRunner or running the mocking_on before hand?

If you are, can you send an example of a method that doesn't get counted.

I guess that you are using typemock 2.1. Are you using Counters using the MockManager or through the Mock object?

Are you running the GUI or console?
answered by (32k points)
0 votes
I figured out my problem. For some reason I was missing the Cor_Enable_Profiling and COR_PROFILER environment variables. After I added them manually typemock started working a lot better. However when I run the mocking_on.bat and mocking_off.bat the environment variables do not change. I am also still having problems with GetCallCount when I run the tests from Nunit.

Do anyone know why I had to manually add these variable and why the bat files are not updating them
answered by (1.2k points)
0 votes
Hi,
This is probrably because you started the nunit before running mocking_on, or you are running them from a different process
You have to run mocking_on before running nunit.

Another way is to run tmockrunner nunit ...

To see if mocking_on works. open a Command Prompt.
run mocking_on and check the variables.
answered by (32k points)
0 votes
I tried tmockrunner and it still did not work. When I use the nunit addin it works fine but if I run my test using nunit it fails most of the time. But it is strange because 1 out of 10 times GetCallCount works when I run it from nunit.
answered by (1.2k points)
0 votes
Hi,
Could you send a little example.
Also, make sure that MockManager.Verify() is called after each test. If you don't this might lead to counters that are left over from a previous test.
answered by (32k points)
0 votes
Hi,
Have you managed to run TypeMock.NET?
answered by (32k points)
...