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

Intellj junit 5 runner does not show failed Steps with assertions. #2920

Closed
abhishek-rdm opened this issue Sep 13, 2022 · 4 comments
Closed

Comments

@abhishek-rdm
Copy link

Hi I am trying to run my serenity tests using Intellj (right click and run tests)

However, I have observed that if my test has a display name and the assertion is used in a step, IntelliJ somehow ignores the failed assertion.

Screenshot 2022-09-13 at 15 51 47

@ExtendWith(SerenityJUnit5Extension.class)
class WhenSearchingForTerms {

    /**
     * Define the webdriver instance to be used for these tests
     */
    @Managed(driver = "chrome", options = "headless")
    WebDriver driver;

    /**
     * Navigation actions. This is a UIInteraction class so it will be instantiated automatically by Serenity.
     */
    NavigateActions navigate;

    /**
     * Actions related to searches. This is a UIInteraction class so it will be instantiated automatically by Serenity.
     */
    SearchActions search;

    /**
     * A page object representing a Wikipedia article that is currently appearing in the browser.
     * Page Objects are automatically initialised by Serenity.
     */
    DisplayedArticle displayedArticle;

    @Test
    @DisplayName("Test Display name")
    void searchBySingleKeyword() {
        search.testAssertion();
    }
}

Screenshot 2022-09-13 at 15 54 28

Could you please help?

@wakaleo
Copy link
Member

wakaleo commented Sep 13, 2022

That's odd. @cliviu does this ring any bells? IntelliJ and Maven are not picking up the failures, though they appear correctly in the reports.

@cliviu
Copy link
Collaborator

cliviu commented Sep 13, 2022

Hey @abhishek-rdm , I can reproduce your problem. Until we fix it, as a workaround try to avoid setting the @DisplayName or add a static initializer in your test class , somethiing like

@BeforeAll
 public static void initialize(){
     Serenity.throwExceptionsImmediately();
 }

@abhishek-rdm
Copy link
Author

@cliviu thanks the workaround also works for me.

@bachhavdipak
Copy link
Contributor

I have verified this issue and its resolved as a part of #3158 PR. I am waiting for author to go through code and accept my PR.

image

wakaleo pushed a commit that referenced this issue Jul 10, 2023
…3158)

* Make Junit recognise and report assertion failures

* resolved formatting issues

---------

Co-authored-by: Dipak Bachhav <dipak.bachhav@specsavers.com>
wakaleo added a commit that referenced this issue Jul 10, 2023
wakaleo added a commit that referenced this issue Jul 10, 2023
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

No branches or pull requests

4 participants