Seddryck / NBi

NBi is a testing framework (add-on to NUnit) for Business Intelligence and Data Access. The main goal of this framework is to let users create tests with a declarative approach based on an Xml syntax. By the means of NBi, you don't need to develop C# or Java code to specify your tests! Either, you don't need Visual Studio or Eclipse to compile your test suite. Just create an Xml file and let the framework interpret it and play your tests. The framework is designed as an add-on of NUnit but with the possibility to port it easily to other testing frameworks.
http://www.nbi.io
Apache License 2.0
107 stars 37 forks source link

TextToToken transformation contribution #621

Closed lukzas closed 3 years ago

lukzas commented 3 years ago

I've implemented text-to-token native transformation to use in my project. It enables to split string with a default | separator and select value of the given index, as well as custom one, passed as parameter.

Function calls

text-to-token(index)
text-to-token(index, separator)

Example

<local-variable name="Table" type="text">
  <item>dbo;Service</item>
</local-variable>
<derived-variable name="TableSchema" based-on="Table" type="text">
  <script language="native">
    text-to-token(0,;)
  </script>
</derived-variable>
<derived-variable name="TableName" based-on="Table" type="text">
  <script language="native">
    text-to-token(1,;)
  </script>
</derived-variable>

I've tested it in many different scenarios already as it's handier than the custom c-sharp transformation. In case you're interested in adding it to the codebase, let me know and I'll create PR.

Seddryck commented 3 years ago

Yes, surely, sounds as a great improvement! Just that I'll probably have to change the default separator to match with existing implementation of text-to-token-count.

lukzas commented 3 years ago

I might adjust it to use whitespace as default instead of the current character :wink:

Seddryck commented 3 years ago

Would be great. Looking forward for your contribution.

Seddryck commented 3 years ago

@lukzas I'd like to make a couple of updates:

Is it OK for you?

lukzas commented 3 years ago

@Seddryck All seem valid points, especially in terms of consistency within the repository. Though the current implementation works for all my use cases and e.g. having support for whitespace other than space is totally unnecessary. Feel free to adjust it as you find most appropriate for the project 😉

Seddryck commented 3 years ago

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