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

Refactor how the values of properties in integration tests are queried #107

Merged
merged 1 commit into from
Jul 8, 2021

Conversation

Azurelol
Copy link
Contributor

@Azurelol Azurelol commented Jul 7, 2021

Description

Rewrites how the values of properties are queried by the integration tests by using a writer object which handles the writing of the query task and provides the functions for testing them.

The newer API simplifies the writing of these property tests:

        when:
        def query = new PropertyQueryTaskWriter("${extensionName}.${property}")
        query.write(buildFile)
        def result = runTasksSuccessfully(query.taskName)

        then:
        query.matches(result, testValue)

Changes

  • UPDATE UnityIntegrationTest
  • IMPROVE *IntegrationTests
  • ADD PropertyQueryTaskWriter

@Azurelol Azurelol requested a review from Larusso as a code owner July 7, 2021 10:30
@Azurelol Azurelol force-pushed the refactor/testing_property_task_queries branch from afc9a25 to 1c0d080 Compare July 7, 2021 10:44
@ghost ghost added add improve and removed refactor labels Jul 7, 2021
@Azurelol Azurelol force-pushed the refactor/testing_property_task_queries branch from 1c0d080 to e2500df Compare July 7, 2021 10:57
Copy link
Member

@Larusso Larusso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to be carefull to not getting too overboard with helper utilities in the specs as it can happen that the specs become unreadable or the maintanance hell when doing bigger shifts.

Also again. You must if you want to use traits be carefull that it won't be added multiple times as it can lead to some very funny linking issues at runtime.


class IntegrationSpec extends nebula.test.IntegrationSpec
implements PropertyUtils, PlatformUtilsImpl {
implements PropertyUtilsImpl, PlatformUtilsImpl {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PropertyUtilsImpl is a trait I hope? Because I get slight nervious ticks when seeing an Interface called Impl :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a trait.

@Azurelol
Copy link
Contributor Author

Azurelol commented Jul 8, 2021

We have to be carefull to not getting too overboard with helper utilities in the specs as it can happen that the specs become unreadable or the maintanance hell when doing bigger shifts.

Also again. You must if you want to use traits be carefull that it won't be added multiple times as it can lead to some very funny linking issues at runtime.

Yes, for the utilities I am keeping in mind that they shouldn't negatively affect the readability of the tests. I went over the design of the API a few times on this newer one.

@Azurelol Azurelol requested a review from Larusso July 8, 2021 07:23
Copy link
Member

@Larusso Larusso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.
We should move this stuff as fast as possible into the shared test lib.

@Azurelol Azurelol merged commit bcfc26d into release/2.x Jul 8, 2021
@Azurelol Azurelol deleted the refactor/testing_property_task_queries branch July 8, 2021 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants