0

Im using nosetests framework for writing test cases. I'm using @attr to pick right test cases

my test.py is something like this...

class Test_module1_tcs:
    @classmethod
    def setup_class(cls):
        ...

    def setup(self):
        ...

    @attr(mod=['mod1', 'mod2'])
    def test_particular_func(self):
        ...

    def teardown(self):
        ...

    @classmethod
    def teardown_class(cls):    
        ...

if i execute this test case, the result will be as below

$nosetests test.py -a mod=mod3

----------------------------------------------------------------------
Ran 0 tests in 0.001s

OK

is there a way where i can get skipped test case info? Mainly because i have more than 1000 test cases, its getting hard to know which test case was skipped.

chk
  • 308
  • 2
  • 10

1 Answers1

0

To achieve what you ask exactly, you will have to make a choice: either run all tests and throw SkipTest exception when attributes are introspected and found matching within a test, or create your own plugin for nose (by cloning attrib.py to keep track of skipped tests).

The best way to guarantee that you have test coverage is to use Ned Batchelder's coverage. Nose has a great support for covering tests as well as code with --cover-tests. You can also set the passing threshold with --cover-min-percentage=100. So with right combination of cover package selection, accumulation of the test results, and passing coverage threshold, you will get assurance that all your tests got executed.

Do not forget to have a look at --cover-html generated files, its an eye candy!

Oleksiy
  • 6,337
  • 5
  • 41
  • 58