0

So I just started a new job and some of the JUnit tests are hitting the network. I want to be able to run these tests without actually taking out my network connection with a ipconfig /release (or similar). Is there anyway to do this?

Ideally I would want to run them in this manner both on the development machine and in the jenkins script.

In case it matters this is a windows shop so all development machines are Windows 7 and so is the Jenkins server.

Another constraint is I don't have admin rights to my machine.

Tiris
  • 160
  • 1
  • 12
  • hunt the "network" tests, annotate them with a `@Category` and leverage that? see https://github.com/junit-team/junit4/wiki/categories –  Jul 21 '16 at 14:15
  • That is not a bad way to go about organizing them but I still want a way for the tests calling out to fail if they are in the unit test category. – Tiris Jul 21 '16 at 15:28
  • I don't understand, you want you "network" tests to 1/ not run and 2/ fail? Maybe http://stackoverflow.com/questions/28397007/how-to-simulate-lack-of-network-connectivity-in-unit-testing –  Jul 21 '16 at 17:31
  • I want my junit tests to run and fail if they are reaching out across the network to do something. Unit tests should be self contained... and developers have been violating that rule. – Tiris Jul 21 '16 at 17:37
  • then the linked question is what you need. –  Jul 21 '16 at 17:39
  • that solution is easier than anything I was cooking up.... I'll give it a go – Tiris Jul 21 '16 at 18:05

0 Answers0