Skip to content

JUnit testcase failure message improvement #890

@daniel-woodhead

Description

@daniel-woodhead

Given this http file

GET https://httpbin.org/anything

?? status == 201

The testcase element in the JUnit output looks like this (with some bits ommitted):

<testcase name="status == 201" classname="GET https://httpbin.org/anything (line: 1)" time="1.367" assertions="1">
  <properties>
    <property name="displayMessage" value="AssertionError [ERR_ASSERTION]: status (200) == 201"/>
    <property name="errorType" value="AssertionError [ERR_ASSERTION]"/>
    <property name="message" value="status (200) == 201"/>
  </properties>
  <failure message="status == 201" type="AssertionError [ERR_ASSERTION]">{"message":"status (200) == 201","name":"AssertionError","stack":"<ommitted>"}</failure>
</testcase>

I'd like to suggest that failure.message be set to the more useful "status (200) == 201" instead of "status == 201".

This would help when httpyac is used in conjunction with https://github.com/dorny/test-reporter which currently displays the message "AssertionError [ERR_ASSERTION]: status == 201".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions