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

New alteration "union" to create a single result-set from two #620

Closed
Seddryck opened this issue Jan 6, 2021 · 5 comments
Closed

New alteration "union" to create a single result-set from two #620

Seddryck opened this issue Jan 6, 2021 · 5 comments

Comments

@Seddryck
Copy link
Owner

Seddryck commented Jan 6, 2021

It should be possible to combine two result-sets if they have the same columns.

<result-set>
  <query> ... </query>
  <alteration>
    <union>
      <result-set>
        <query>...</query>  
      <result-set>
    </union>
  </alteration>
</result-set>
@Seddryck Seddryck added this to the v1.23 milestone Jan 6, 2021
@Seddryck
Copy link
Owner Author

Seddryck commented Jan 6, 2021

Implemented and documented in 1.23.0-beta.72 or on nuget via Update-Package NBi.Framework -version 1.23.0-beta0072.

@Seddryck Seddryck closed this as completed Jan 6, 2021
@lukzas
Copy link
Contributor

lukzas commented Jan 11, 2021

@Seddryck It seems to work only with result-set element inside union as schema validation error is thrown during runtime:

NBi.NUnit.Runtime.TestSuite.ExecuteTestCases:
System.ArgumentException : The test suite is not valid. Check with the XSD. 1 error has been found during the validation of the test-suite:
	At line 514: The element 'union' in namespace 'http://NBi/TestSuite' has invalid child element 'query' in namespace 'http://NBi/TestSuite'. List of possible elements expected: 'result-set' in namespace 'http://NBi/TestSuite'.

Also, I've looked into the schema, and indeed result-set is the only element specified for the union:

<xs:complexType name="union-type">
    <xs:sequence>
      <xs:element name="result-set" type="result-set-type" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="column-identity" type="column-identity-enum" use="optional"/>
  </xs:complexType>

I'm not sure if it's a beta limitation or a bug 😜

@Seddryck
Copy link
Owner Author

Seddryck commented Jan 11, 2021

This a feature. If it was directly a query and not a result-set, it wouldn't have been possible to add an alteration to this second result-set. I'll update the feature-request.

@Seddryck
Copy link
Owner Author

But something to improve is probably that we should be able to have more than a single union.

@lukzas
Copy link
Contributor

lukzas commented Jan 11, 2021

Ok. Then I guess docs (https://www.nbi.io/docs/resultset-alteration/) also need an update as there is an example where you can use query inside.

<result-set>
  <query>
    select 'Apple' as Fruit, 10 as Qty union all select 'Orange', 15
  </query>
  <alteration>
    <union column-identity="name">
      <query>
        select 5 as Qty, 'Apple' as Fruit, 'Fall' as Season
      </query>
    </union>
  </alteration>
</result-set>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants