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

Add test message to test runner #470

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

stefan-toubia
Copy link
Contributor

@stefan-toubia stefan-toubia commented Nov 14, 2019

What has Changed?

  • Add test message to the test runner output
  • Reformat error and failure test runner output

Closes #425

Sample outputs

Failure test

(deftest fail-test
  (testing "The test context"
    (is (= 1 2) "Math is hard")
    (is (= 1 3))))
FAIL in my-project.upload-helpers-test/fail-test (upload_helpers_test.clj:10):
The test context: Math is hard
expected: 1
  actual: (2)

FAIL in my-project.upload-helpers-test/fail-test (upload_helpers_test.clj:11):
The test context
expected: 1
  actual: (3)

Without context or message

(deftest fail-test-2
  (is (= 1 2)))
FAIL in my-project.upload-helpers-test/fail-test-2 (upload_helpers_test.clj:14):
expected: 1
  actual: (2)

Error test

(deftest error-test
  (testing "The test context"
    (is (= (/ 1 0) 1) "The test message")))
ERROR in my-project.upload-helpers-test/error-test (line 19):
The test context: The test message
   error: java.lang.ArithmeticException: Divide by zero (Numbers.java)
expected: (= (/ 1 0) 1)

Note on error outputs: The file in the error result references the source of the exception (Numbers.java), but the line number is from the test file (upload_helpers_test.clj), so I moved the file to the error message line.

My Calva PR Checklist

I have:

  • Read How to Contribute.
  • Made sure I am directing this pull request at the dev branch. (Or have specific reasons to target some other branch.)
  • Made sure I am changed the default PR base branch, so that it is not master. (Sorry for the nagging.)
  • Tested the VSIX built from the PR (well, if this is a PR that changes the source code.) You'll find the artifacts by clicking Show all checks in the CI section of the PR page, and then Details on the ci/circleci: build test. (For now you'll need to opt in to the CircleCI New Experience UI to see the Artifacts tab, because bug.)
    • Tested the particular change
    • Figured if the change might have some side effects and tested those as well.
    • Smoke tested the extension as such.
  • Referenced the issue I am fixing/addressing in a commit message for the pull request.
  • Updated the [Unreleased] entry in CHANGELOG.md, linking the issue(s) that the PR is addressing.

The Calva Team PR Checklist:

Before merging we (at least one of us) have:

  • Made sure the PR is directed at the dev branch (unless reasons).
  • Read the source changes.
  • Given feedback and guidance on source changes, if needed. (Please consider noting extra nice stuff as well.)
  • Tested the VSIX built from the PR (well, if this is a PR that changes the source code.)
    • Tested the particular change
    • Figured if the change might have some side effects and tested those as well.
    • Smoke tested the extension as such.
  • If need be, had a chat within the team about particular changes.

Ping @PEZ, @kstehn, @cfehse

@PEZ
Copy link
Collaborator

PEZ commented Nov 14, 2019

Thanks!!! Looks super on the description level. We will hava a look!

Looking at the sample output I wonder if this:

ERROR in my-project.upload-helpers-test/error-test (line 19):

shows up as a clickable link in the output? If not, I think it could be made to do that. There are other ways to find links there, but anyway, good to be able to do it right from the output.

@stefan-toubia
Copy link
Contributor Author

@PEZ glad to contribute!

To clarify about the clickable links in the output, this is not something that is in current Calva test runner, right? I wasn't familiar with generating source file links, but I just did a little searching. Based on what I've found it seems you need the full file path, which is not provided in the test results. I just checked, neither the failure or error outputs are links.

I haven't worked on VS Code extensions before, so I'm unfamiliar with the API. Are you aware of another solution?

@PEZ
Copy link
Collaborator

PEZ commented Nov 14, 2019

I don't think there is a particular API for it. But if we print the full path to the file like so:

/path/to/file.clj:42

It gets a clickable link. That said, I now see that the output is rather a namespace-qualified symbol, so it is not as easy to convert it to an absolute path as I first thought it was. Feel free to deem it out of scope for this PR. 😄

@PEZ
Copy link
Collaborator

PEZ commented Nov 14, 2019

I've had a look and tested this some. Looks solid and I am ready to merge, if you think it is ready, @stefan-toubia .

@stefan-toubia
Copy link
Contributor Author

@PEZ After investigating a little more, it's a little out of scope 😅 I will keep it in mind as I make an attempt at #424 , since I'll have to dig into NReplClient.

I'm good to go with the current changes, let's merge!

@PEZ PEZ merged commit c98baf3 into BetterThanTomorrow:dev Nov 14, 2019
@stefan-toubia stefan-toubia deleted the wip/test-runner-message branch November 14, 2019 22:08
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.

2 participants