Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Problems running NUnit tests

Problems running NUnit tests

Scheduled Pinned Locked Moved .NET (Core and Framework)
sysadminquestionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    G Ringbom
    wrote on last edited by
    #1

    This might not be the best forum for this question but I hope someone will be able to answer it anyway. I have a bunch of nunit tests that I want to run. The problem is that they fail if run them all. If I run them one by one they work fine. These tests tests some sockets network code. The network connection is done using a static object. This means all tests use the same network connection object. I thought that the tests run one after the other, but it seems they run in parallell sometimes. This has the effect that a test connects to the server and starts doing what the test does and then another test opens a new connection with the effect that the state needed in the first tests is lost, and thereby causing the first test to fail. So the real question is how NUnit runs the tests? Does it run them one after the other or (atleast to some degree) in parallell?

    K 1 Reply Last reply
    0
    • G G Ringbom

      This might not be the best forum for this question but I hope someone will be able to answer it anyway. I have a bunch of nunit tests that I want to run. The problem is that they fail if run them all. If I run them one by one they work fine. These tests tests some sockets network code. The network connection is done using a static object. This means all tests use the same network connection object. I thought that the tests run one after the other, but it seems they run in parallell sometimes. This has the effect that a test connects to the server and starts doing what the test does and then another test opens a new connection with the effect that the state needed in the first tests is lost, and thereby causing the first test to fail. So the real question is how NUnit runs the tests? Does it run them one after the other or (atleast to some degree) in parallell?

      K Offline
      K Offline
      keith maddox
      wrote on last edited by
      #2

      I've not noticed them running in parallel and I don't believe that they do but I have had similar problems and upon closer inspection determined that I have introduced some state dependencies. Anyway, the solution for me was to use Setup and Teardown (Nunit things) code to make sure state was setup correctly for each test that I ran. That just might work for you too.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups