Comments (10)
@elyezer that sounds good to me. More flexible than the original request.
And I completely understand about the priority of the xml imports. I'm definitely interested in that feature as well.
Thanks,.
Scott
from betelgeuse.
@spoore1 I will check but to maintain same behavior as other fields it would be something like:
:title: TEAM-TC: Feature Name: Running Feature with command option 1
And the title will be TEAM-TC: Feature Name: Running Feature with command option 1
. Right now betelgeuse is assuming that the first line is the title, but it should consider the :title:
field instead if it is present.
According to the current code it already considers that:
title = test.tokens.get('title', test.name)
Which means if :title:
field is present it will use that information instead of the test method name as in Python source code. Let me know if you are able to use that otherwise I will work on fixing it.
Will wait to close this issue until I get the feedback if it is working or not.
from betelgeuse.
Sorry, I don't think I was clear. I wasn't suggesting replacing :title:, I was suggesting if --title-prefix option is used from the command line add that string before the :title: value from code. something like
if title_prefix:
title = title_prefix + title
So regardless of whether it's using test method name or the ":title:" value from docstring, it would add the prefix to the beginning of title.
Does that make more sense?
from betelgeuse.
Now it makes sense but I don't think we would add that because imagine if someone wants to have a prefix for description for example that will require a new option, so on and so forth. Since this is based on a specific project need and Betelguese is meant to be more generic as possible that prefix needs to be repeated on each title.
I will continue thinking about this so maybe we can implement some inheritance from a broad context like the class docstring or module docstring but that will require to add that information on the test docstring which may not look good, for example the module test_prefix.py:
"""Module test_prefix.py
:title: Global prefix:
"""
class MyTestCase():
def test_something(self):
"""My test
:title: {super} more content goes here
""""
But that will not avoid the repetition.
Let's keep this issue open and hear from others.
from betelgeuse.
Your example above would work for me. It would still greatly reduce the line length for Title in each test case. Is that method a possibility?
from betelgeuse.
@spoore1 I think it is possible, just need to define which should be the markup to tell you want to include the super value and then extend it. I will think on a possibility to adding variable support. With that said, I am not sure about a due date because it would require a good effort to support that. I will update here when I have a plan.
from betelgeuse.
I've been thinking about this issue and figured out that Betelgeuse user may want to add their business logic when providing the final value for a given token. With that in mind I think if Betelgeuse provides a way to specify a Python module where it can inspect and check for functions like get_<token_name>
in order to get information for a given token that will allow users to do whatever they want to do in order to have the final token value.
For example, a new option to betelgeuse command group would be added so a user can specify the Python path for the tokens getter module:
betelgeuse --tokens-getter-module 'my_package.tokens_getter'
The path to module must be available at the Python path so Betelgeuse will be able to import it.
Then an example tokens_getter.py module would be:
"""Tokens getter
Helpers for getting tokens value
"""
def get_title(docstring, tokens, invalid_tokens):
return u'{prefix} {title}'.format(prefix='MY_PREFIX', title=tokens.get('title'))
The benefits of having that kind of feature is that each Betelgeuse user will have the power of customization and business logic specific to the user's project will be handled by them.
The API for the get_<token_name>
functions should be better defined so all the information the user can have is available to them.
from betelgeuse.
@spoore1 let me know what do you think about the proposal above.
Also I am going to be focusing on releasing the xml-test-case which is the base required feature. I will be able to work on improvements only after I finish the base features for the XML importers, currently, I am not able to define a date because I am depending on bug being fixed on the importers to proceed the Betelgeuse code is already written.
from betelgeuse.
I've updated the title to match more what this issue will accomplish.
The plan will be to allow Betelgeuse to receive an optional path where it can import some methods (if present) to edit the token's value.
The API will be like described in #94 (comment).
from betelgeuse.
I am going to close this issue since this functionality is already supported by providing a config file. The config allows to specify functions to help get the field values, with that one using Betelgeuse is able to customize the field values programaticaly.
Check the docs http://betelgeuse.readthedocs.io/en/stable/config.html for more information on how to create your config file.
from betelgeuse.
Related Issues (20)
- upstream token is not valid across different project, make it editable only when present HOT 1
- Provide RST parsing errors and warnings
- We should be able to pass some tokens (Requirement,CaseLevel, CaseImportance, TestType, etc.) through command line HOT 2
- Please add Requirement and Automation Script fields to be used by Betelgeuse Configuration Module HOT 1
- Make use of <testcase status-id="approved"> to update Test Case status HOT 1
- Provide help message for the --config-module option
- Document a list of custom fields and its values - IDs in Polarion HOT 2
- allow '.' as test path
- Allow sending files to Polarion HOT 4
- Request to parse multiple lines for fields like "title" in docstrings HOT 2
- Make Betelgeuse Python 3.6+ only HOT 7
- Update the betelgeuse requirement command to generate the XML for the Requirement Importer
- Pytest style parametrization HOT 6
- test case id not derived by test-run
- [test-case] Higher-level metadata might be used when keys use inconsistent casing
- pylarion now supporting python 3 HOT 2
- Traceback when running betelgeuse for insights tests HOT 2
- "betelgeuse test-run --status inprogress" isnt updating the test-run correctly HOT 3
- AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' with Python 3.9 HOT 2
- Move to Github Actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from betelgeuse.