1
0

TESTING.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. === The Quick Guide to OpenSim Unit Testing ===
  2. == Running Tests ==
  3. On Linux you will need to have NUnit installed (http://www.nunit.org).
  4. This is commonly available in distribution package repositories.
  5. When this is installed, run the command
  6. > nant test
  7. Please see the TESTING ON WINDOWS section below for Windows instructions.
  8. == Adding Tests ==
  9. Tests should not be added to production assemblies. They should
  10. instead be added to assemblies of the name
  11. My.Production.Assembly.Tests.dll. This lets them easily be removed
  12. from production environments that don't want the bloat.
  13. Tests should be as close to the code as possible. It is recommended
  14. that if you are writing tests they end up in a "Tests" sub-directory
  15. of the directory where the code you are testing resides.
  16. If you have added a new test assembly that hasn't existed before you
  17. must list it in both ".nant/local.include"
  18. for it to be accessible to Linux users and to the continuous
  19. integration system.
  20. ==TESTING ON WINDOWS==
  21. To use nunit testing on opensim code, you have a variety of methods. The
  22. easiast methods involve using IDE capabilities to test code. Using
  23. VS2005/2008 I recommend using the testing capabilities of Resharper(commercial)
  24. or TestDriven.Net(free). Both will recognize nunit tests within your
  25. application and allow you to test them individually, or all at once, etc. You
  26. will also be able to step into debug mode into a test through these add-ins
  27. enabling a developer to jump right in and see how a specific
  28. test-case/scenerio works.
  29. Additionally, it is my understanding that sharpdevelop and monodevelop have
  30. their own nunit testing plugins within their IDE. Though I am not certain of
  31. their exact feature set or stability.
  32. == Using NUnit Directly ==
  33. The NUnit project is a very mature testing application. It can be obtained
  34. from www.nunit.org are via various package distrobutions for Linux. Please be
  35. sure to get a .Net 2.0 version of Nunit, as OpenSim makes use of .Net 2.0
  36. functionality.
  37. Nunit comes with 2 tools that will enable you to run tests from assembly
  38. inputs. Nunit-gui and nunit-console. NUnit-gui is a console that will let
  39. you view the execution of various tests within your assemblies and give visual
  40. indication of teir success or failure. This is a useful tool for those who
  41. lack IDE addins ( or lack IDEs at all ).
  42. Nunit console allows you to execute the nunit tests of assemblies via console.
  43. Its output will show test failures and successes and a summary of what
  44. happened. This is very useful for a quick overview and/or automated testing.
  45. Windows
  46. Windows version of nunit-console is by default .Net 2.0 if you downloaded the
  47. .Net 2.0 version of Nunit. Be sure to setup your PATH environment variable.
  48. Linux & OSX
  49. On these operating systems you will have to use the command "nunit-console2"
  50. Example
  51. nunit-console2 OpenSim.Framework.Tests.dll (on linux)
  52. nunit-console OpenSim.Framework.Tests.dll (on windows)