0

I'm using SpecFlow with NUnit. Some scenarios require reboot computer in the middle of their running. I did not find any approaches to do it for specified technologies. Is there someone who can help me?

2 Answers2

1

Call a command line command from your code to reboot the system should do it, but it would also kill the test run on that machine, so you would also need to schedule the test run to restart after the reboot.

Windows reboot command:

shutdown /r /t 0
Niels van Reijmersdal
  • 2,038
  • 1
  • 20
  • 36
  • Thank you for your answer. Yes, I've considered this approach, but it needs to save Specflow tests context before reboot and restore it after reboot by some way..That is the most technical complexity – Demid Dementev Oct 12 '18 at 14:46
  • 1
    You could split the test runs into different test-suites. One before the reboot and one after. And load the second one after reboot, it should create its own context. – Niels van Reijmersdal Oct 12 '18 at 14:48
  • Thank you. Because there is no way to automatically handle reboot via SpecFlow with NUnit, I decided to use PsExec with calling nunit-console with the first part of tests, then calling windows reboot command and after that calling nunit-console with the second part of tests. Jenkins will be responsible for calling these 3 commands and proper handling of their results. – Demid Dementev Oct 15 '18 at 12:57
1

As advised Niels, you can split your tests. And, after test is finished, save data on hard drive, then in next test suite read that data.

Ukrainis
  • 534
  • 2
  • 16