lczub / TestLink-API-Python-client

A Python client to use the TestLink API
104 stars 63 forks source link

TestReporter should not be initialiased with test case list and status #95

Open lczub opened 6 years ago

lczub commented 6 years ago

Pull request #94 added the class TestReporter and MixinSubclasses to automatically create missing test plans, platforms and builds, when reporting test case results.

Current behaviour is, that the list of test cases and status must be set during the TestReport init . So if different stati should be reported for the same platform, build, plan combination, separate report instances are needed. Sample

    tls = testlink.TestLinkHelper('https://testlink.corp.com/testlink/lib/api/xmlrpc/v1/xmlrpc.php',
                                  'devkeyabc123').connect(testlink.TestlinkAPIClient)
    tgr_p = TestGenReporter(tls, ['TEST-123', 'TEST-456'], testprojectname='MANUALLY_MADE_PROJECT',
                                  testplanname='generated', platformname='gend', buildname='8.fake', status='p')
    tgr_p.report()                      
    tgr_f = TestGenReporter(tls, ['TEST-321', 'TEST-654'], testprojectname='MANUALLY_MADE_PROJECT',
                                 testplanname='generated', platformname='gend', buildname='8.fake', status='f')
    tgr_f.report()   

A better approach would be, that the init do not need the test case list and status and this can be set with the report() call. Suggestion

    tls = testlink.TestLinkHelper('https://testlink.corp.com/testlink/lib/api/xmlrpc/v1/xmlrpc.php',
                                  'devkeyabc123').connect(testlink.TestlinkAPIClient)
    tgr = TestGenReporter(tls, testprojectname='MANUALLY_MADE_PROJECT',
                                  testplanname='generated', platformname='gend', buildname='8.fake')
    tgr.report(['TEST-123', 'TEST-456'], status='p')                      
    tgr.report(['TEST-321', 'TEST-654'], status='f')