Skip to content

Conversation

Brian-Williams
Copy link

@Brian-Williams Brian-Williams commented Oct 30, 2017

  1. TestReporter's subclasses can be used to idempotently generate required components of testlink before sending the report to a specified testcase.
  2. TestGenReporter is a default combination of all the TestReporter's subclasses and will try to generate everything it's subclasses is capable of.
  3. Added TestLinkHelper._setParams to simplify libraries that need to overwrite how a helper aquires it's parameters
  4. Added TestlinkAPIClient.getTestCaseByVersion to expose the common need of gettting the latest testcase by default. It was already used, but not a function in this class and has uses elsewhere.

g4l4drim and others added 8 commits November 26, 2012 07:11
TestLink-API-Python-client v0.4.0-RC1
new TestLink-API-Python-client release candidate v0.4.5-RC1
new TestLink-API-Python-client release
report test case execution + upload test case attachment
Fix getTestCaseCustomFieldValue "version" parameter type
error fix: getTestProjectByName do not return array
TestReporter's subclasses can be used to idempotently generate
  required components of testlink before sending the report to
  a specified testcase.
TestGenReporter is a default combination of all the TestReporter's
  subclasses and will try to generate everything it's subclasses
  is capable of.
Added TestLinkHelper._setParams to simplify libraries that need to
  overwrite how a helper aquires it's parameters
Added TestlinkAPIClient.getTestCaseByVersion to expose the common
  need of gettting the latest testcase by default. It was already
  used, but not a function in this class and has uses elsewhere.

This makes it easier to support different param setting.
@lczub lczub self-assigned this Nov 3, 2017
@lczub lczub self-requested a review November 3, 2017 19:07
@lczub lczub added this to the v0.6.5 milestone Nov 3, 2017
Copy link
Owner

@lczub lczub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Brian-Williams,

thanks for your TestReporter request. I have some suggestions for improvements.

a) init.py should not import the class TestGenReporter, cause it is an example and uses hard coded url/dev key.

b) separate TestGenReporter and TestReport into two files and move TestGenReporter into the example dir.
Then the functional classes from TestReport can be imported in init.py

c) What about changing the naming of TestReport.AddTestReporter to TestReport.AddTestCaseReporter ?
Using 'Add' as class name prefix is a little bit confusing, cause it mention an action, what normal sounds for a method. But currently I have no better idea.

c) Why does TestGenReporter init TestLinkHelper with a hard coded url and devkey? If this sample should be usable for others, wouldn't it be better to call TestLinkHelper without such hard coded stuff? The other examples like TestLinkExample.py has the preconditions, that the environment variables TESTLINK_API_PYTHON_SERVER_URL and TESTLINK_API_PYTHON_DEVKEY have valid settings.

d) Would it be posssible, that you add a short sample description in doc/usage.rst ?

e) Would it be possible, that you add some tests under tests/utest-offline or tests/utest-online aTestLinkHelper ? If you prefer pytest instead unittest this would be fine also.

f) Why does getTestCaseByVersion raises a RunTimeError and not a TestLinkError or one of its childs?

How do you think about these points?
Regards Luiko

Brian Williams added 3 commits November 5, 2017 01:52
Moved TestGenReporter to it's own file and better documented it's
intended use case with warnings.
@Brian-Williams
Copy link
Author

Hi lczub/Luiko,

a) TestGenReporter doesn't have hard coded url or dev key. It's goal is to present the most common use case of always reporting a result if at all possible. In my mind it's value is if other fields are generatable in the future someone's code wouldn't have to be changed in order to get those new benefits. They would simply update this dependency. This model is sometimes used in security repos where there are default objects that will update with the spec. I believe passlib does this.

b) I've moved and provided better docs for TestGenReporter. Not importing the functional classes from TestReport is intentional. They started as and are still mostly intended as Mixin classes. I never intended for them to be used in isolation, but after writing them realized some organizations might want only that one functionality. It would be a little silly to force them to create a new mixin instead of importing the functional one. i.e. why force MyTestReporter = TestReporter(AddTestCaseReporter) when they can simply import the class that adds that functionality AddTestCaseReporter.

However, I still think that is an edge case. The vast majority of users will be using the classes effectively as mixins which are only adding functionality, which is why the classes have function/method style names. I understand not everyone likes mixin design or naming functions so am open to change, but that was my reasoning.

c) That's a better name, done. The naming style is explained above in b.

c2) I don't believe it does. Is this talking about the docstring? In my experience most teams using this will have an automation dev key and a single testlink server they are setting it up with. If that's not your experience I would be open to changing the docstring.

d+e) I can try to do this when I have more time.

f) Changed to TLArgError.

I am unexpectedly busy all of the sudden. I will try to get this fit for purpose, but if my responses are slow I apologize in advance.

Thanks,
Brian

@lczub
Copy link
Owner

lczub commented Nov 5, 2017

Hello Brian-Williams,

I very much apologize for my missreading of your code.
It seams, that I had eggs on my eyes, cause I always read the last lines of TestGenReport class comment as functional code and does not recognize, that this lines are a sample inside the class comment. Shame on me.
I now understand your intention to import only TestGenReport and also understand your time pressure.

I think with your separation of TestGenReport this pull request is ok and I will pull it into the master and integrate it later on into the tl-future branch. Test and usage.rst will be separate tasks, if we find time for them.

Many thanks for your work
Regards Luiko

@lczub
Copy link
Owner

lczub commented Nov 5, 2017

Hello Brian-Williams,
fyi, with commit 1a8b5d8 I extended the examples for your pull request and with #95 I defined a change request, how the status reporting should be done more flexible. I will try to find a solution for that in the next weeks.

Regards Luiko

lczub pushed a commit that referenced this pull request Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants