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