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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inferring tests for different suite names #33

Closed
JorgeCastilloPrz opened this issue Sep 4, 2018 · 3 comments 路 Fixed by #34
Closed

Inferring tests for different suite names #33

JorgeCastilloPrz opened this issue Sep 4, 2018 · 3 comments 路 Fixed by #34
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JorgeCastilloPrz
Copy link

JorgeCastilloPrz commented Sep 4, 2018

First of all, thank you very much for this super cool lib, really good work as always :). Karumi stays strong 馃挭 :P.

I got the following test:

@Test
fun showConversationsOnSuccessfulLoading() {
        givenConversationsOnBothDataSources(anyIndividualConversations())

        viewModel.viewState.observeForever(viewStateObserver)

        viewModel.viewState.value.matchWithSnapshot()
}

Expected behaviour

Test should pass and store the snapshot on its first run.

Actual behaviour

I'm getting the following error (which is expected and well described).

Kotlin Snapshot library couldn't find the name of the test. Review if the test case file or the spec file contains the word test or spec or specify a snapshot name manually, this is a requirement needed to use Kotlin Snapshot.

This is due to my test suite being called ConversationsEndToEndShould. So the explicit error message was helpful and accurate. I've fixed it by naming the snapshot, like:
viewModel.viewState.value.matchWithSnapshot("Conversations loaded")

I've not digged yet on how you've implemented the test indexing but It'd be nice if it wasn't depending on the test or test class names that much (in case it's possible), or alternatively add a rule for the "should" substring.

"Should" is kind of used in tests broadly since it gives a good naming when you run them, like:
captura de pantalla 2018-09-04 a las 12 33 12

That's used more often in java probably, since Kotlin already supports using human readable names with spaces and so on in tests, but still it'd be a nice to have.

Version of the library

0.3.0

@pedrovgs pedrovgs added help wanted Extra attention is needed enhancement New feature or request labels Sep 4, 2018
@tonilopezmr
Copy link

Yes, the reason is we are looking for classes contains test or spec.

I'm going to fix it by improving the test case name extractor.

@tonilopezmr
Copy link

@JorgeCastilloPrz For the current version 0.3.0 you must add the word Test or Spec in your tests, but for the next one you will use any other names for test classes after merge #34 馃憤

@JorgeCastilloPrz
Copy link
Author

Perfect, thanks for this :)

@tonilopezmr tonilopezmr self-assigned this Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants