Skip to content

Add option to override test suite name#25

Merged
cclauss merged 4 commits intonodejs:mainfrom
fmartinsons:add-name-opts
Jul 13, 2022
Merged

Add option to override test suite name#25
cclauss merged 4 commits intonodejs:mainfrom
fmartinsons:add-name-opts

Conversation

@fmartinsons
Copy link
Contributor

Because the default might not be suitable for all usage
(full input file path without extenstion)

Signed-off-by: Frederic Martinsons [email protected]

cclauss added a commit that referenced this pull request May 9, 2021
cclauss added a commit that referenced this pull request May 9, 2021
* isort: —rc is now deprecated

* Add blank line to placate isort (lifted from #25)

* Make isort a mandatory test

* isort --verbose to document files skipped

* isort --verbose is too verbose
@fmartinsons
Copy link
Contributor Author

For information, please do not merge this one already (first I'll rebase and second I search how to improve xml formatting).
For the record, I work with a C test suite made using glib tests framework which output TAP (https://developer.gnome.org/glib/stable/glib-Testing.html) and I look for presenting result in junit under jenkins (thanks to https://plugins.jenkins.io/junit/).

To compare I have an xml produced by pytest framework (pytest_xml.txt

which gives this structure in jenkins:
Screenshot from 2021-05-09 08-58-48

I have also an xml (sfxlib_xml.txt produced by tap2junit from the following tap file (sfxlib_tap.txt which gives this output:

Screenshot from 2021-05-09 08-58-30

I don't understand the presences of testsuites at top of the file generated by tap2junit (while the one with pytest don't have it) and also I think the use of classname attribute may help the output (because like you can see in the screenshot, I have this ugly "(root)" at first)

Because the default might not be suitable for all usage
(full input file path without extenstion)

Signed-off-by: Frederic Martinsons <[email protected]>
@cclauss
Copy link
Collaborator

cclauss commented May 9, 2021

I am not a fan of naming the test to be something different than the root of the basename of in_file because...

Explicit is better than implicit. -- Zen of Python

Why not just extract name from in_file?

import os
os.path.splitext(os.path.basename("a/b/c.txt"))[0]  # 'c'

@fmartinsons
Copy link
Contributor Author

fmartinsons commented May 9, 2021

I am not a fan of naming the test to be something different than the root of the basename of in_file because...

Explicit is better than implicit. -- Zen of Python

Why not just extract name from in_file?

import os
os.path.splitext(os.path.basename("a/b/c.txt"))[0]  # 'c'

I don't see that to be a implicit vs explicit problem but to let the user choose if he wants to (because there is no special reason for using the filename currently being parsed for the testsuite name, they can be totally unrelated to what the testuiste name is).
By the way this is what pytest do for junit output , see junit_suite_name).
But what you suggest can be applied for the default behavior when no name is given. What do you think ?

…Case

In order to allow a better formatting of the junit XML result and not
hardcode None into classname attribute if we can avoid it.

Add also a test with test description contains '.'

Signed-off-by: Frederic Martinsons <[email protected]>
@fmartinsons
Copy link
Contributor Author

Hello @cclauss , any chance to land this merge request ? Is my suggestion of changing the default value of test suite name and let the option to the user suits you ?

@fmartinsons
Copy link
Contributor Author

Any news here ?

@cclauss cclauss requested a review from richardlau July 13, 2022 11:23
@cclauss cclauss merged commit af11dc2 into nodejs:main Jul 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants