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
106 stars 37 forks source link

Template generated with Genbi fails to run when using sql-run #268

Closed fpvmorais closed 7 years ago

fpvmorais commented 7 years ago

Hello,

I've found a weird behavior. When you generate a nbits file from a template on Genbi that has an sql-run task on setup the line for the task gains a "version":

<sql-run name="MySQLtoRun.sql" version="SqlServer2014" />

This causes the following error:

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 11: The 'version' attribute is not declared.

If you delete the version all goes well

Seddryck commented 7 years ago

The command sql-run is expecting a version attribute since version 1.14

I'd guess that the binaries in the genbi folder are not the same than the binaries in the nbi folder ... the last one is probably 1.13 and doesn't support this new attribute.

Seddryck commented 7 years ago

Hello @fpvmorais Does it solve your issue? if yes could you close the issue, if not provide additional details?

fpvmorais commented 7 years ago

Hi,

At the moment I can't test, I'm at a client. As soon I can do it I'll get to you.

Thanks

2017-04-04 18:18 GMT+01:00 Cédric L. Charlier notifications@github.com:

Hello @fpvmorais https://github.com/fpvmorais Does it solve your issue? if yes could you close the issue, if not provide additional details?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Seddryck/NBi/issues/268#issuecomment-291570072, or mute the thread https://github.com/notifications/unsubscribe-auth/AVc99g3F_xh5gPGERpA2hSmDTr3uM12Jks5rsntYgaJpZM4Mtov4 .

fpvmorais commented 7 years ago

I'm using the release 1.14.0.7.

The dll versions from Genbi folder:

Name Version
Antlr3.Runtime.dll 3.5.0.2
Antlr4.StringTemplate.dll 4.0.6.9004
ICSharpCode.TextEditor.dll 3.2.1.6466
Microsoft.AnalysisServices.AdomdClient.dll 12.0.2000.8 ((SQL14_RTM).140220-1752)
NBi.Core.dll 1.14.0.7
NBi.GenbiL.dll 1.14.0.7
NBi.Service.dll 1.14.0.7
NBi.Xml.dll 1.14.0.7
NCalc.dll 1.4.3
Sprache.dll 2.1.0.0

The version from Framework folder:

Name Version
Antlr3.Runtime.dll 3.5.0.2
Antlr4.StringTemplate.dll 4.0.6.9004
MarkdownLog.dll 0.9.3.36
Microsoft.AnalysisServices.AdomdClient.dll 12.0.2000.8 ((SQL14_RTM).140220-1752)
NBi.Core.dll 1.14.0.7
NBi.Core.SqlServer2012.dll 1.14.0.7
NBi.Core.SqlServer2014.dll 1.14.0.7
NBi.Core.SqlServer2016.dll 1.14.0.7
NBi.Framework.dll 1.14.0.7
NBi.NUnit.dll 1.14.0.7
NBi.NUnit.Runtime.dll 1.14.0.7
NBi.Xml.dll 1.14.0.7
NCalc.dll 1.4.3
nunit.framework.dll 2.6.4.14350

Genbi.exe version is 1.14.0.7

Am I missing something?

Seddryck commented 7 years ago

Huuum my mistake sounds like a bug

Seddryck commented 7 years ago

I fixed the issue in a new build on the branch 1.15 at https://ci.appveyor.com/project/Seddryck/nbi/build/1.15.0-ci.77 Keep in mind that this build already includes a few items from the 1.15 release:

IMO, it shouldn't be an issue to issue this CI build, but if you really want a 1.14 branch build, tell me (but it will take a few days).

Seddryck commented 7 years ago

You don't need to necessary updates the binaries for genbi (will avoid to have #161 included in your new generation) but you need the new binaries for the framework folder.

If it resolves the issue, consider to close the issue, if not tell me.

fpvmorais commented 7 years ago

While testing I had some issues:

Exception:

NBi.NUnit.Runtime.TestSuite.Test run MyPackage.dtsx:
Exception during the setup of the test: Object reference not set to an instance of an object.
   at NBi.Core.SqlServer.Smo.BatchRunCommand..ctor(IBatchRunCommand command, SqlConnection connection) in c:\projects\nbi\NBi.Core.SqlServer\Smo\BatchRunCommand.cs:line 21
   at NBi.Core.SqlServer.Smo.SmoBatchRunnerFactory.Get(IBatchCommand command, IDbConnection connection) in c:\projects\nbi\NBi.Core.SqlServer\Smo\SmoBatchRunnerFactory.cs:line 17
   at NBi.Core.Batch.BatchRunnerFactory.Get(IBatchCommand command) in c:\projects\nbi\NBi.Core\Batch\BatchRunnerFactory.cs:line 36
   at NBi.Core.DecorationFactory.Get(IDecorationCommand command) in c:\projects\nbi\NBi.Core\DecorationFactory.cs:line 34
   at NBi.Core.GroupCommand.Sequential() in c:\projects\nbi\NBi.Core\GroupCommand.cs:line 58
   at NBi.Core.GroupCommand.Execute() in c:\projects\nbi\NBi.Core\GroupCommand.cs:line 26
   at NBi.NUnit.Runtime.TestSuite.ExecuteSetup(SetupXml setup) in c:\projects\nbi\NBi.NUnit.Runtime\TestSuite.cs:line 124

Stack Trace:

at NBi.NUnit.Runtime.TestSuite.HandleExceptionDuringSetup(Exception ex) in c:\projects\nbi\NBi.NUnit.Runtime\TestSuite.cs:line 150
at NBi.NUnit.Runtime.TestSuite.ExecuteSetup(SetupXml setup) in c:\projects\nbi\NBi.NUnit.Runtime\TestSuite.cs:line 135
at NBi.NUnit.Runtime.TestSuite.ExecuteTestCases(TestXml test) in c:\projects\nbi\NBi.NUnit.Runtime\TestSuite.cs:line 74

My nbits file:

<?xml version="1.0" encoding="utf-8"?>
<testSuite xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://NBi/TestSuite">
    <settings>
        <default apply-to="assert">
            <connectionString>Provider=SQLNCLI11.1;Initial Catalog=SSDH_DW;Data Source=.;Persist Security Info=True;Integrated Security=SSPI;</connectionString>
        </default>
        <default apply-to="system-under-test" >
            <connectionString>Provider=SQLNCLI11.1;Initial Catalog=SSDH_DW;Data Source=.;Persist Security Info=True;Integrated Security=SSPI;</connectionString>
        </default>
        <default apply-to="setup-cleanup" >
            <connectionString>Provider=SQLNCLI11.1;Initial Catalog=SSDH_DW;Data Source=.;Persist Security Info=True;Integrated Security=SSPI;</connectionString>
        </default>
    </settings>
    <test name="Test run MyPackage.dtsx">
        <setup>
            <tasks parallel="false">
                <sql-run name="Activate.sql" version="SqlServer2016" />
                <etl-run version="SqlServer2016" server="localhost" name="MyPackage.dtsx" catalog="SSISDB" folder="SSDH.ETL" project="SSDH" bits-32="true" timeout="99999">
                    <parameter name="MaxExtractionRecords">
                        10
                    </parameter>
                </etl-run>
            </tasks>
        </setup>
        <system-under-test>
            <execution>
                <query>
                    SELECT 1 FROM dbo.DestinationTable
                    </query>
            </execution>
        </system-under-test>
        <assert>
            <row-count>
                <more-than>0</more-than>
            </row-count>
        </assert>
        <cleanup>
            <sql-run name="Inactivate.sql" version="SqlServer2016" />
        </cleanup>
    </test>
</testSuite>
Seddryck commented 7 years ago

Your connectionString for the setup-cleanup default is an OleDB connection. sql-run doesn't support this kind of connection it must be a Native one. Just remove the part Provider=SQLNCLI11.1; and it should be OK.

I'll improve documentation on this.

Seddryck commented 7 years ago

But not sure it will fix your issue ... Why am I so complex :-s

fpvmorais commented 7 years ago

LOL

Worked great! There's no need to create new branch for 1.14 .

I will replace the *.dll's for the ones from the 1.15 build.

Thank you very much 👍

Seddryck commented 7 years ago

Available in beta: https://github.com/Seddryck/NBi/releases/tag/v1.15-beta