Build before running unit test

It appears that dependent projects aren't built before running unit tests?
This is a problem as my unit tests are in a different project than the code
under test.


12 comments
Comment actions Permalink

How do you run tests?

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Mark Wilden" <mark@mwilden.com> wrote in message
news:e3ovk1$d8h$1@is.intellij.net...

It appears that dependent projects aren't built before running unit tests?
This is a problem as my unit tests are in a different project than the
code under test.



0
Comment actions Permalink

I also am having trouble with unnecessary builds when starting a test.

If I select a test in the test runner and start using the toolbar button
"Debug Selected Test", the test runs without a build. (Build Projects Before
Run is not activated)
If I activate "Build projects before run", then my projects build. They seem
to do a clean before the build which seems unnecessary since no code has
changed. This takes several minutes in my environment.

If I select the test in my source code and run from the "Unit Test Method"
icon, then parts of my project rebuild just as if the Build Projects before
run were activated. This happens every time I repeat the command even when I
don't change any code.


0
Comment actions Permalink

Please open the ReSharper->Options->Unit Test Runner options page. Which
debug method is selected?

If the debugging is used other that "attach to process", then the settings
of the projkect configuration is altered, and Visual Studio start building.
We cannot modify this behavour.

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Jeff" <jeffwalsh@hotmail.com> wrote in message
news:e3q9sh$9s$1@is.intellij.net...
>I also am having trouble with unnecessary builds when starting a test.
>

If I select a test in the test runner and start using the toolbar button
"Debug Selected Test", the test runs without a build. (Build Projects
Before Run is not activated)
If I activate "Build projects before run", then my projects build. They
seem to do a clean before the build which seems unnecessary since no code
has changed. This takes several minutes in my environment.

>

If I select the test in my source code and run from the "Unit Test Method"
icon, then parts of my project rebuild just as if the Build Projects
before run were activated. This happens every time I repeat the command
even when I don't change any code.



0
Comment actions Permalink

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3q0ut$vog$1@is.intellij.net...

How do you run tests?


By clicking the icon next to the test in the editor, or by clicking the icon
in your Unit Test Runner window.

Are dependent projects supposed to be built when these actions are taken?
Thanks.

///ark

>> It appears that dependent projects aren't built before running unit
>> tests? This is a problem as my unit tests are in a different project than
>> the code under test.


0
Comment actions Permalink

"Jeff" <jeffwalsh@hotmail.com> wrote in message
news:e3q9sh$9s$1@is.intellij.net...

>I also am having trouble with unnecessary builds when starting a test.
>

If I select a test in the test runner and start using the toolbar button
"Debug Selected Test", the test runs without a build. (Build Projects
Before Run is not activated)
If I activate "Build projects before run", then my projects build. They
seem to do a clean before the build which seems unnecessary since no code
has changed. This takes several minutes in my environment.

>

If I select the test in my source code and run from the "Unit Test Method"
icon, then parts of my project rebuild just as if the Build Projects
before run were activated. This happens every time I repeat the command
even when I don't change any code.


This is just about the opposite of the trouble I'm having! :)

My problem is that I have to do a CtrlShiftB if I change the project under
test, otherwise, it doesn't get built. And I do have Build Projects Before
Run selected.

Maybe I should mention that I do test-driven development, where I write the
unit test first, run it (it fails), then add the code to the project under
test to make it pass.


0
Comment actions Permalink

Options were set to Use the current startup project.
Now that I've changed it to Attach to running process, it seems much better.
Thanks for the help.

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3ql7v$472$1@is.intellij.net...

Please open the ReSharper->Options->Unit Test Runner options page. Which
debug method is selected?

>

If the debugging is used other that "attach to process", then the settings
of the projkect configuration is altered, and Visual Studio start
building. We cannot modify this behavour.

>

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Jeff" <jeffwalsh@hotmail.com> wrote in message
news:e3q9sh$9s$1@is.intellij.net...

>>I also am having trouble with unnecessary builds when starting a test.
>>
>> If I select a test in the test runner and start using the toolbar button
>> "Debug Selected Test", the test runs without a build. (Build Projects
>> Before Run is not activated)
>> If I activate "Build projects before run", then my projects build. They
>> seem to do a clean before the build which seems unnecessary since no code
>> has changed. This takes several minutes in my environment.
>>
>> If I select the test in my source code and run from the "Unit Test
>> Method" icon, then parts of my project rebuild just as if the Build
>> Projects before run were activated. This happens every time I repeat the
>> command even when I don't change any code.
>>
>



0
Comment actions Permalink

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3ql7v$472$1@is.intellij.net...

Please open the ReSharper->Options->Unit Test Runner options page. Which
debug method is selected?

>

If the debugging is used other that "attach to process", then the settings
of the projkect configuration is altered, and Visual Studio start
building. We cannot modify this behavour.


Just as a data point, none of the options on that page affect the fact that
the project being tested does not get built when the unit tests in the test
project are run.


0
Comment actions Permalink

Hello Mark,

could you please clarify how 'the project being tested' and 'the test project'
are
related to each other? Are they actually the same project or the latter one
references the former one?
Thanks.

Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3ql7v$472$1@is.intellij.net...

>> Please open the ReSharper->Options->Unit Test Runner options page.
>> Which debug method is selected?
>>
>> If the debugging is used other that "attach to process", then the
>> settings of the projkect configuration is altered, and Visual Studio
>> start building. We cannot modify this behavour.
>>

Just as a data point, none of the options on that page affect the fact
that the project being tested does not get built when the unit tests
in the test project are run.



0
Comment actions Permalink

Yes, the depending project should be built.

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Mark Wilden" <mark@mwilden.com> wrote in message
news:e3qm4q$9m8$1@is.intellij.net...

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3q0ut$vog$1@is.intellij.net...

>
>> How do you run tests?
>

By clicking the icon next to the test in the editor, or by clicking the
icon in your Unit Test Runner window.

>

Are dependent projects supposed to be built when these actions are taken?
Thanks.

>

///ark

>
>>> It appears that dependent projects aren't built before running unit
>>> tests? This is a problem as my unit tests are in a different project
>>> than the code under test.
>



0
Comment actions Permalink

"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:c8a894d91746058c842259eb14167@news.intellij.net...

Hello Mark,

>

could you please clarify how 'the project being tested' and 'the test
project' are
related to each other? Are they actually the same project or the latter
one references the former one?
Thanks.


They are different projects, and the test project references the project
under test.

It is best to create a separate test project. If you put your tests in the
same project as the code under test, you end up shipping those tests and
references to nunit.framework.

>> Just as a data point, none of the options on that page affect the fact
>> that the project being tested does not get built when the unit tests
>> in the test project are run.


0
Comment actions Permalink

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in
message news:e3rtjv$3r9$1@is.intellij.net...

Yes, the depending project should be built.


Thanks, Eugene -- submitted.

///ark

>>>> It appears that dependent projects aren't built before running unit
>>>> tests? This is a problem as my unit tests are in a different project
>>>> than the code under test.


0
Comment actions Permalink

Jamie Cansdale (of TestDriven.NET) appears to have solved this problem. It
occurs when a solution includes an ASP.NET Web project, or a project
references a Web project. He is apparently using a different API to build
now, and the problem (in TestDriven.NET) is now gone.


0

Please sign in to leave a comment.