author | Sue Sohn <Susan.Sohn@Oracle.COM> |
Fri, 20 Aug 2010 11:31:18 -0600 | |
changeset 862 | e9f31f2f2f2d |
parent 842 | e8046b4f26e8 |
child 1272 | 7788c9e14874 |
permissions | -rw-r--r-- |
842
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
1 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
3 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
7 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
12 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
18 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
20 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
21 |
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
22 |
# |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
23 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
24 |
This directory contains configuration files for Nose, the PyUnit test runner |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
25 |
for the slim_source gate. In order to run the tests you should: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
26 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
27 |
1) Install Nose and the coverage module: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
28 |
* Installing the Python setup tools: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
29 |
pkg install library/python-2/setuptools-26 |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
30 |
* Running the command: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
31 |
easy_install-2.6 nose coverage |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
32 |
(The warning messages during installation may be ignored) |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
33 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
34 |
Note: As of June 22, 2010, Nose is currently in the JUCR process, |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
35 |
and may be available from the contrib repository at a |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
36 |
later date. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
37 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
38 |
2) Build the gate, per the instructions in usr/src/README. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
39 |
Note: The slim_test program will test Python code from |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
40 |
the proto area, so the associated files must be |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
41 |
re-built to pick up any changes to tested code. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
42 |
The tests themselves are run from the source files, |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
43 |
so changes to tests do not require a re-build. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
44 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
45 |
3) Use the "bldenv" command to set-up the build and test environment: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
46 |
/opt/onbld/bin/bldenv -d ../../developer.sh |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
47 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
48 |
4) Run the following command to execute all the currently known tests: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
49 |
./slim_test -c tests.nose |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
50 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
51 |
The "slim_test" command is a thin wrapper around the "nosetests" command, |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
52 |
and accepts the same arguments. To see a full list of available arguments, run: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
53 |
./slim_test -h |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
54 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
55 |
To run an individual test: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
56 |
./slim_test -c tests.nose TEST_NUM [TEST_NUM]... |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
57 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
58 |
Where TEST_NUM is the number of the test you'd like to run, and may be |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
59 |
specified multiple times to run more than one test. Test numbers are |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
60 |
indicated during a full run. To query the test numbers without executing the |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
61 |
tests, run: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
62 |
./slim_test -c tests.nose --collect-only |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
63 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
64 |
Note: To reset the numbering, delete the "usr/src/.noseids" file |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
65 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
66 |
To run all tests within a specific file or package, omit the "-c tests.nose" |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
67 |
portion, and supply the path to the file or package, relative to the usr/src |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
68 |
directory of the workspace. For example, the following command runs only |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
69 |
the liberrsvc_pymod tests: |
862
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
70 |
./slim_test lib/liberrsvc_pymod/test |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
71 |
|
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
72 |
To run all tests in a specific file: |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
73 |
./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
74 |
|
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
75 |
To run a specific class of tests in that file: |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
76 |
./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py:error_service |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
77 |
|
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
78 |
To run a particular test in that class: |
e9f31f2f2f2d
16423 Updates to AI schema should be made
Sue Sohn <Susan.Sohn@Oracle.COM>
parents:
842
diff
changeset
|
79 |
./slim_test lib/liberrsvc_pymod/test/test_liberrsvc.py:error_service.test_create_error_info |
842
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
80 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
81 |
To report code coverage metrics along with test results, add a "--with-cover" |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
82 |
flag: |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
83 |
./slim_test -c tests.nose --with-cover |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
84 |
|
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
85 |
To add a set of tests to the suite, update the tests.nose file. See that |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
86 |
file for more details. |
e8046b4f26e8
16105 slim_source gate could use infrastructure for running unit tests
Keith Mitchell <keith.mitchell@oracle.com>
parents:
diff
changeset
|
87 |