Skip to content

Commit 3eaf32b

Browse files
author
Brian Williams
committed
Add TestReporter to __init__ & move testgenreporter + docs
Moved TestGenReporter to it's own file and better documented it's intended use case with warnings.
1 parent fdf1a42 commit 3eaf32b

File tree

3 files changed

+29
-21
lines changed

3 files changed

+29
-21
lines changed

src/testlink/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
from .testlinkapigeneric import TestlinkAPIGeneric
2323
from .testlinkapi import TestlinkAPIClient
2424
from .testlinkhelper import TestLinkHelper
25-
from .testreporter import TestGenReporter
25+
from .testreporter import TestReporter, TestGenReporter

src/testlink/testgenreporter.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from .testreporter import AddTestReporter, AddBuildReporter, AddTestPlanReporter, AddPlatformReporter, TestReporter
2+
3+
4+
class TestGenReporter(AddTestReporter, AddBuildReporter, AddTestPlanReporter, AddPlatformReporter, TestReporter):
5+
"""
6+
This is the default generate everything it can version of test reporting.
7+
8+
This class will always try to report a result. It will generate everything possible and will change with additional
9+
Add*Reporter's added to the repo. As such you should only use this if you want to always generate everything this
10+
repo is capable of. If you want what it does at any specific time you should create this class in your project and
11+
use directly.
12+
13+
If you don't want to generate one of these values you can 'roll your own' version of this class with only the
14+
needed features that you want to generate. As stated above if you *only* want to generate what this class currently
15+
does. Copying it into your project is the best practice as this class is mutable inside the project!
16+
17+
For example if you wanted to add platforms and/or tests to testplans, but didn't want to ever make a new testplan
18+
you could use a class like:
19+
`type('MyOrgTestGenReporter', (AddTestReporter, AddPlatformReporter, TestReporter), {})`
20+
21+
Example usage with fake testlink server test and a manual project.
22+
```
23+
tls = testlink.TestLinkHelper('https://testlink.corp.com/testlink/lib/api/xmlrpc/v1/xmlrpc.php',
24+
'devkeyabc123').connect(testlink.TestlinkAPIClient)
25+
tgr = TestGenReporter(tls, ['TEST-123'], testprojectname='MANUALLY_MADE_PROJECT', testplanname='generated',
26+
platformname='gend', buildname='8.fake', status='p')
27+
```
28+
"""

src/testlink/testreporter.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,3 @@ def buildid(self):
218218
def _generate_buildid(self):
219219
r = self.tls.createBuild(self.testplanid, self.buildname, self.buildnotes)
220220
return r[0]['id']
221-
222-
223-
class TestGenReporter(AddTestReporter, AddBuildReporter, AddTestPlanReporter, AddPlatformReporter, TestReporter):
224-
"""This is the default generate everything it can version of test reporting.
225-
226-
If you don't want to generate one of these values you can 'roll your own' version of this class with only the
227-
needed features that you want to generate.
228-
229-
For example if you wanted to add platforms and/or tests to testplans, but didn't want to ever make a new testplan
230-
you could use a class like:
231-
`type('MyOrgTestGenReporter', (AddTestReporter, AddPlatformReporter, TestReporter), {})`
232-
233-
Example usage with fake testlink server test and a manual project.
234-
```
235-
tls = testlink.TestLinkHelper('https://testlink.corp.com/testlink/lib/api/xmlrpc/v1/xmlrpc.php',
236-
'devkeyabc123').connect(testlink.TestlinkAPIClient)
237-
tgr = TestGenReporter(tls, ['TEST-123'], testprojectname='MANUALLY_MADE_PROJECT', testplanname='generated',
238-
platformname='gend', buildname='8.fake', status='p')
239-
```
240-
"""

0 commit comments

Comments
 (0)