Hello,
I have been using nCrunch for over 2 years now and like the unit testing approach for running tests locally on my machine during development.
I am currently looking for a solution for running unit tests automatically on a periodic basis on a VM in my server environment, and wanted to know what the best approach for doing this would be and whether or not i can use nCrunch alone or need to integrate it with other tools. Basically i just want these unit tests to run automatically on a periodic basis on my VM and get alerts of any test that fails.
Here is what i'm looking to do:
1) Run a suite of unit tests on a VM in my server environment on a periodic basis (say every 12 hours).
2) Receive some type of notification (email would be best) on the status of what tests passed and any that did not pass after all tests are run for the given run interval.
Is this possible to do using nCrunch alone or do i need to bring in any other tools to accomplish this task or build a custom solution? If nCrunch cannot accomplish this alone, what is the most common approach to implementing this scenario?
Any help / suggestions / assistance with setting up this automated unit testing scenario in my server environment would be greatly appreciated, thanks!
-Mark
Setup Problems
Using NCrunch to Run Automated Unit Tests on Server VM
Started by KabanaSoft on 6,582 views
Remco NCrunch Developer
#7229
19 Apr 2015 23:18 UTC
Hi Mark -
NCrunch itself isn't really designed as a periodic test runner - it's intended to run tests constantly rather than on a timer, which would complicate using it for this scenario. There would be nothing to stop you adding the periodic logic inside a test - though you might need to do some interesting things to allow the results to be reported consistently. For example, you could have a test that checks the current time whenever it is run, and has its own log or data file that it checks this against. If it's been more than 12 hours since the VM logic inside the test was last run, the test will execute it again .. otherwise, it will pull the results of the previous run from the log file and report this instead. NCrunch may run the test 1000 times over the space of a day, but the logic gate inside the test would prevent it executing its logic more than twice over a 24 hour period.
As for the VM, there are a number of ways you could do this. You could set up a VM as a grid node server with NCrunch, and use the RequiredCapabilityAttribute (http://www.ncrunch.net/documentation/reference_runtime-framework_requires-capability-attribute) to specify that the test can only be run on this grid node server.
Alternatively, if you are doing cross-platform testing, you could develop your own infrastructure for launching a clean VM as part of the test run, then setting up some kind of RPC connection into the VM in order to execute the code remotely, reporting the results back to the test runner outside the VM. This would take some invesetment, but it could work very well for some scenarios.
NCrunch itself isn't really designed as a periodic test runner - it's intended to run tests constantly rather than on a timer, which would complicate using it for this scenario. There would be nothing to stop you adding the periodic logic inside a test - though you might need to do some interesting things to allow the results to be reported consistently. For example, you could have a test that checks the current time whenever it is run, and has its own log or data file that it checks this against. If it's been more than 12 hours since the VM logic inside the test was last run, the test will execute it again .. otherwise, it will pull the results of the previous run from the log file and report this instead. NCrunch may run the test 1000 times over the space of a day, but the logic gate inside the test would prevent it executing its logic more than twice over a 24 hour period.
As for the VM, there are a number of ways you could do this. You could set up a VM as a grid node server with NCrunch, and use the RequiredCapabilityAttribute (http://www.ncrunch.net/documentation/reference_runtime-framework_requires-capability-attribute) to specify that the test can only be run on this grid node server.
Alternatively, if you are doing cross-platform testing, you could develop your own infrastructure for launching a clean VM as part of the test run, then setting up some kind of RPC connection into the VM in order to execute the code remotely, reporting the results back to the test runner outside the VM. This would take some invesetment, but it could work very well for some scenarios.
@Remco - Thanks for the response and suggestions, i figured that this was the case.
I think i'm just going to go the route of implementing my own periodic unit testing service and bypass NCrunch, it really shouldn't be too difficult to define the tests to be run and have them run periodically with a little code.
NCrunch is good at what it does and i'll leave it to what its good at :).
I think i'm just going to go the route of implementing my own periodic unit testing service and bypass NCrunch, it really shouldn't be too difficult to define the tests to be run and have them run periodically with a little code.
NCrunch is good at what it does and i'll leave it to what its good at :).
Post a reply
Log in to reply.