question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[junit] Expose the ability to write trait tags in testcase nodes

See original GitHub issue

Since record_property is incompatible with the xunit2 family, we should add a fixture or some mechanism to do something similar with the supported trait tag.

Especially now that xunit2 is the default family with the 6.0 release, it would be a useful addition.

Example usage

def test(record_trait):
    record_trait("key", "value")

Example output in testcase node

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <testsuite errors="0" failures="0" hostname="scoria" name="pytest" skipped="0" tests="1" time="4.497"
               timestamp="2020-07-24T10:09:52.287953">
        <testcase classname="test_example.TestExample" name="test_a" time="4.497">
            <traits>
                <trait name="key" value="value"/>
            </traits>
        </testcase>
    </testsuite>
</testsuites>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
nicoddemuscommented, Jul 25, 2020

if traits behave the same as properties in junit1, then we should just use the new nodes on the new version

Agreed, and it is trivial to implement: 73172b88d21e0e07757844ceaaae897444cae706

I didn’t open a PR just because I couldn’t find a schema for that version (TBH I didn’t spend too much time searching because I’m short on time now). @maspe36 do you happen to have one handy?

3reactions
RonnyPfannschmidtcommented, Jul 24, 2020

if traits behave the same as properties in junit1, then we should just use the new nodes on the new version

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tagging and Filtering JUnit Tests - Baeldung
In this article, we saw a way to tag and filter test cases with JUnit 5. We used the Tag annotation and also...
Read more >
JUnit 5 User Guide
JUnit Jupiter API for writing tests and extensions. ... Denotes that a method is a template for test cases designed to be invoked...
Read more >
Introduction to JUnit: Unit Testing Springboot Services - Adeva
This post will focus on presenting the JUnit framework used within the context of a typical Java project written using the Springboot framework....
Read more >
Java Unit Testing with JUnit and TestNG
To run the test case, right-click on the file ⇒ Run as ⇒ JUnit Test. The test result is shown in the JUnit...
Read more >
Unit Testing CRUD Endpoints of a Spring Boot Java Web ...
Our testing framework of choice will be JUnit, it provides assertions to ... that the method to which this annotation is attached can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found