Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:57
    astef opened #3444
  • 11:14
    LirazShay commented #1388
  • 06:55
    TFTomSun edited #3443
  • 06:53
    TFTomSun edited #3443
  • 06:52
    TFTomSun edited #3443
  • 06:52
    TFTomSun edited #3443
  • 06:51
    TFTomSun edited #3443
  • 06:48
    TFTomSun edited #3443
  • 06:48
    TFTomSun edited #3443
  • 06:48
    TFTomSun edited #3443
  • 06:45
    TFTomSun opened #3443
  • Dec 13 20:36
    bruthig-g opened #328
  • Dec 13 06:16
    CharliePoole commented #1388
  • Dec 13 05:36
    nobrayner commented #1388
  • Dec 13 05:30
    nobrayner commented #1388
  • Dec 13 05:30
    nobrayner commented #1388
  • Dec 12 11:31
    CharliePoole labeled #715
  • Dec 12 11:31
    CharliePoole review_requested #715
  • Dec 12 06:26
    Build #4660 passed
  • Dec 12 06:23
    CharliePoole opened #715
Johan Larsson
@JohanLarsson
one easy solution that is perhaps not ideal would be to have the slow tests in a separate project
I often do that with UI-tests as it is annoying to write code while they run :D
Chris Heneghan
@cristobalito
We've already used [TestCategory(...)] and separate projects - in fact the last retro suggested extending this approach.
Johan Larsson
@JohanLarsson
Another easy alternative if you are using a pull request model is to not build & test much locally
Chris Heneghan
@cristobalito
Yup - already offload to TeamCity where possible, but for various reasons, we're somewhat resource constrained
Johan Larsson
@JohanLarsson
how long do they take to run?
Chris Heneghan
@cristobalito
sorry - forgot to reply to that - approx. 10m
Johan Larsson
@JohanLarsson
I was expecting worse :D
still no fun
Chris Heneghan
@cristobalito
Those are some interesting benchmarks - surprised to see VS so quick
@JohanLarsson - yeah, there's a few challenges here - stop writing slow tests being a priority
Johan Larsson
@JohanLarsson
I should update them but they are a bit of a pain
Made screen recordings and grabbed the time from there
should script it
nunit has always been faster than xunit when I have benchmarked
Chris Heneghan
@cristobalito
I've got a suspicion that test discovery on R# / Rider is slow
but that's not based on any real evidence
Johan Larsson
@JohanLarsson
I once refactored a project to use xunit just because I felt like using it
But reverted after first testrun
The r# runner is much faster than the vs runner now
The vs runner does not run the tests at all many times
Just shows the blue spinner things for a couple of minutes
do you use moq?
Chris Heneghan
@cristobalito
Re: moq = yes
Johan Larsson
@JohanLarsson
I benchmarked and found nsubstitute to be 100x faster for common cases
Do you use a container in the tests?
Chris Heneghan
@cristobalito
container = no
Johan Larsson
@JohanLarsson
ok, I was going to suggest dryioc if so, it is fast
Johan Larsson
@JohanLarsson
@cristobalito you should ask your question again, I spammed it off screen
Chris Heneghan
@cristobalito
need to get off - will post again later - I've been looking at custom attributes and I think that they might work
Chris Heneghan
@cristobalito
After a bit of playing around, I think CustomAttributes are the way to go for me
Chris Heneghan
@cristobalito
Does anyone happen to know if Rider uses NUnit for test discovery or whether it uses its own logic?
Chris Heneghan
@cristobalito
According to this they have their own runner: nunit/nunit3-vs-adapter#487
Terje Sandstrom
@OsirisTerje
@cristobalito If you read this comment https://github.com/nunit/nunit3-vs-adapter/issues/487#issuecomment-389209491 they [JetBrains] say they are using the adapter for .net core. As they have their own testhost they have full control over what they send to the adapter. The adapter itself are aware of the explicit, but doesn't do anything really with it, so if they pass it down through the RunTest method for test cases, it will be run, and they can handle the removal of the same too.
Chris Heneghan
@cristobalito
ta @OsirisTerje
AaronHerchmer
@AaronHerchmer
hi everyone, i'm sending parameters to a unit test and the parameters and expected result are all custom objects, but with different values for each test case. How come these tests show up as multiple results for the same test as opposed to a group of tests?
Mikkel Nylander Bundgaard
@mikkelbu
@AaronHerchmer How are you executing the tests? Visual Studio? Can you provide a screenshot of how it looks
DJ Tinkers
@TinkersDj_twitter

Anyone interested in an opensource project?

Spec oriented development speeds up programming by generating code based on tests/specs. Tests required will be the same or less specs as a normal developer writes.

https://github.com/Neur0plasticity/spec-dev

MSG me if interested

Christopher C. Johnson
@Programazing

From what I found if I want to pass in a Dictionary I have to wrap that in a static IEnumerable<object[]> and pass that by calling [TestCaseSource(nameof(method))].

Is that the only way? I ask because in the very next test I need that data again but I also need an int. If I add an int to that object[] then the first test will fail because it expects that int to be passed.

This is what I have setup so far: https://gist.github.com/Programazing/181a28607fb924f9368a6d68a12a88ea

or can I somehow pick which object[] to use for which test?
I also realize this could be a totally wrong way to approach this. I just found that on a random SO answer the other night.
Christopher C. Johnson
@Programazing
I just started making custom test data methods for any test that needs data that looks a certian way
Mikkel Nylander Bundgaard
@mikkelbu
@Programazing I'm not sure what you are trying to obtain, but if you want to use the same dictionary in multiple tests, then you can do something like (note that you don't need to use [Theory] and that most of these attributes are for providing multi testcases to a test a not just one testcase). The code below will create one test that gets the string and the dictionary and another test that will have 3 test cases - each testcase will consist of a number (from 1 to 3) and the dictionary.
using NUnit.Framework;
using System.Collections.Generic;

[TestFixture]
public class BigramTests
{
    [Test]
    public void Create_ReturnsCorrect_NumberOfBrigams(
        [Values("The quick brown fox and the quick blue hare")] string input,
        [ValueSource(nameof(Create_ReturnsCorrect_NumberOfBrigams_TestData))] Dictionary<string, int> actual)
    {
...
    }

    [Test]
    public void Create_ReturnsCorrect_NumberOfBrigams(
    [Values(1, 2, 3)] int input,
     [ValueSource(nameof(Create_ReturnsCorrect_NumberOfBrigams_TestData))] Dictionary<string, int> actual)
    {
...
    }

    static IEnumerable<Dictionary<string, int>> Create_ReturnsCorrect_NumberOfBrigams_TestData()
    {
        var bigram = new Dictionary<string, int>()
            {
                { "the quick", 2 },
                { "quick brown", 1 },
                { "brown fox", 1 },
                { "fox and", 1 },
                { "and the", 1 },
                { "quick blue", 1 },
                { "blue hare", 1 }
            };

        return new[] { bigram };
    }
}
You can read more about the different attributes at https://github.com/nunit/docs/wiki/Attributes
mmaist
@mmaist
Hey, anyone have an idea when 3.16 is releasing? On that same note, can anyone comment on the stability of the prelease version?
Terje Sandstrom
@OsirisTerje
@mmaist Assume you mean the adapter. I want to get it out soon, but would like some more feedback on it. There are 19 downloads so far of the pre-release, no one have been screaming so it might be working as it should. However, there are 3 issues which it doesn't fix, but which it was expected to fix. If you have the possibility to give it a quick spin on your build, it would be awesome
For anyone else wanting to give it a try, grab the pre-release here: https://www.myget.org/feed/nunit/package/nuget/NUnit3TestAdapter
avilv
@avilv
psst @CharliePoole , you around ? :)
Mikkel Nylander Bundgaard
@mikkelbu
@avilv I don't think that Charlie uses Gitter, so the best option is probably to add a comment to the relevant issue
avilv
@avilv
@mikkelbu thanks