Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting defaults for tokens #116

Open
spoore1 opened this issue Jul 20, 2016 · 7 comments
Open

setting defaults for tokens #116

spoore1 opened this issue Jul 20, 2016 · 7 comments

Comments

@spoore1
Copy link
Contributor

spoore1 commented Jul 20, 2016

It would be useful to be able to set default vaults for tokens that would apply to all test cases when testimony runs. If I have a test suite with a lot of test cases where several tokens are set identically, it would be helpful to set that outside the tests.

A config file alongside the tests maybe? Or command line options? Or maybe a new token to pull that info from a config file?

Keeping things flexible, if a token is defined in a config, it would be overridden if defined in a test case.

Does that make sense?

@elyezer
Copy link
Collaborator

elyezer commented Jul 20, 2016

@spoore1 defining the tokens on the module level does not help? Or you are looking for a solution that will be global so every module would inherit it?

@spoore1
Copy link
Contributor Author

spoore1 commented Jul 20, 2016

Can I do that? Add a docstring for the module with tokens?

Yeah, actually, that's better. Tokens at the module and class level would both be very useful I think. At the moment, I see them listed as Unexpected tokens:

# cat test_2.py 
"""
@casecomponent: ipa
@requirement: My test Req
"""

class TestExample(object):
    def test_case_0001(self):
        """ Test Case 0001 """
        pass

    def test_case_0002(self):
        """ Test Case 0002 """
        pass

    def test_case_0003(self):
        """ Test Case 0003 """
        pass
# testimony print test_2.py 
test_2.py
=========

test_case_0001
--------------

Test:
 Test Case 0001

Unexpected tokens:
  Casecomponent: ipa
  Requirement: My test Req

test_case_0002
--------------

Test:
 Test Case 0002

Unexpected tokens:
  Casecomponent: ipa
  Requirement: My test Req

test_case_0003
--------------

Test:
 Test Case 0003

Unexpected tokens:
  Casecomponent: ipa
  Requirement: My test Req

@omaciel
Copy link
Member

omaciel commented Jul 20, 2016

@spoore1 I believe what you want is pass --tokens and/or --minimum-tokens to testimony like we're doing in Robottelo

@spoore1
Copy link
Contributor Author

spoore1 commented Jul 20, 2016

@omaciel you are correct. I had misunderstood the help listing for that. Looks like that works now:

# testimony print test_2.py --tokens="id, description, test, casecomponent, requirement" --minimum-tokens="test"
test_2.py
=========

test_case_0001
--------------

Casecomponent:
 ipa

Requirement:
 My test Req

Test:
 Test Case 0001


test_case_0002
--------------

Casecomponent:
 ipa

Requirement:
 My test Req

Test:
 Test Case 0002


test_case_0003
--------------

Casecomponent:
 ipa

Requirement:
 My test Req

Test:
 Test Case 0003

That's awesome. I think this can be closed. Is this in the doc? If not, might be a good example to add.

Thanks,
Scott

@omaciel
Copy link
Member

omaciel commented Jul 20, 2016

@spoore1 not sure but if not we should definitely document it. @sthirugn ?

@elyezer
Copy link
Collaborator

elyezer commented Jul 21, 2016

We need to clarify the documentation

@sthirugn
Copy link
Contributor

sthirugn commented Jul 21, 2016

This is briefly explained in http://testimony-qe.readthedocs.io/en/latest/#test-case-docstring-format. But examples are not shown on how to override the defaults. +1 to adding examples.

This can be addressed in #119.

@spoore1: If you want to contribute to this doc, please feel free to. Otherwise it will be worked eventually. And please close this issue if you are okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants