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

Runnable short title #1448

Closed

Conversation

duncanbeevers
Copy link
Contributor

Fixes #1230

In this approach, rather than modifying the hook titles at failure time, a run-time shortTitle method is exposed on Suite, Runnable, and Hook.

In the case of a Suite and a Runnable, this method returns the current value of title attribute.
In the case of a Hook running in the context of a test, the shortTitle will reflect both the hook's own title and the title of the currently-executing test.

@dasilvacontin
Copy link
Contributor

Needs tests asserting this works.

@duncanbeevers
Copy link
Contributor Author

Added basic specs for shortTitle, and the existing fullTitle tests continue to pass.

@boneskull
Copy link
Member

Some discussion in #1447.

@duncanbeevers
Copy link
Contributor Author

@boneskull In #1447, you ask "Practically, how does a hook receive a title?"

The crux of the issue is that titles were all set when objects such as Runnables and Hooks were initialized. Since Hooks were run multiple times, the static title failed to reflect the context in which it was being run.

The first part of this refactor was to retrieve the Runnable and Hook titles through a method rather than a property, so that it could be retrieved dynamically by the Reporters.

In the case of Runnables, this method simple proxied to the existing static title property.
In the case of Hooks, more dynamism is introduced. First the Hook's own, original title is retrieved, followed by the title of the Runnable in whose context the Hook is running. The two are concatenated, resulting in a Hook shortTitle that changes as each test is run.

@jbnicolai
Copy link

Is there anyhting holding of a merge of either this or #1447? @boneskull @danielstjules? LGTM :)

@duncanbeevers thanks for the effort!

@jbnicolai jbnicolai force-pushed the master branch 3 times, most recently from 2f458ab to 2952eca Compare July 5, 2015 10:25
@jbnicolai
Copy link

Closing in favor of #1447

@jbnicolai jbnicolai closed this Jul 5, 2015
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.

More descriptive beforeEach/afterEach messages
4 participants