VS2017 (15.5.6), NUnit 3.10.1, R# 17.3.2 -> runsettings not read in when starting tests via R#

Hello everybody

I've got a testproject where I use NUnit 3.10.1 and some *.runsettings files for different environments. I'm using VS2017 (15.5.6)

When I start the tests via the native "Test Explorer" window of VS, my runsettings file is read correctly and I the values are accessible via "NUnit.Framework.TestContext.Parameters" in code.

However, when I use the R# "right click -> Run Unit Tests" or start the tests via "Unit Test Sessions" window that comes with R#, the settings file isn't read in and "NUnit.Framework.TestContext.Parameters;" contains 0 parameters.

I've tried pretty much all of the Unit Test Options in "ReSharper -> Options... -> Unit Testing" but nothing seems to help. Any idea what's the problem here? The R# test features are just so convenient, it would be a shame to not be able to use them anymore.

 

Thanks a lot!

7
6 comments
Official comment

Hello Rafael!

 

runsettings file support is not yet implemented for NUnit, please refer to the following feature request - https://youtrack.jetbrains.com/issue/RSRP-449753.

You are welcome to comment or vote for it.

Thank you.

Avatar
Permanently deleted user

I have exactly the same problem.  I've enabled MSTest support and selected my Test Settings File but TestContext.Parameters does not contain any entries.

1
Avatar
Permanently deleted user

The use case for this is to test the time it takes to execute an API Call
Example:
int MAX_TIME_TO_EXECUTE;
if (!int.TryParse(TestContext.Parameters["MaxExecuteTime"], out MAX_TIME_TO_EXECUTE))
{ //defensive code so will still run in resharper
MAX_TIME_TO_EXECUTE = 900;
}
DateTime startTime = DateTime.Now;
var result = _sut.Get(VALID_USER_ID);
DateTime endDateTime = DateTime.Now;

TimeSpan timeToExc = endDateTime.Subtract(startTime);

//did the call execute in a acceptable time frame
Assert.LessOrEqual(timeToExc.Milliseconds,MAX_TIME_TO_EXECUTE);

 

The time it take to run in local environment versus in the cloud are different.  In the cloud it should be lower.

0
Avatar
Permanently deleted user

I'd like to read some parameters from the TestContext. Is there any other way to specify parameters for unit testing under Resharper?

1

Would love to see this fixed. I'm actually trying to onboard a team to R#. They're used to `.runsettings` files and this is a showstopper as far as they're concerned.

1

The same problem.
The only thing which stops me to start using R# is this issue.
Please, fix it. It will make possible to use R# for major part of QA engineers.

1

Please sign in to leave a comment.