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

Genbi fails silently on CLI #678

Closed fdw closed 1 year ago

fdw commented 2 years ago

We want to call Genbi.exe automatically, using the CLI. Unfortunately, errors are silently caught and $? is True, even if the GUI shows an error dialog and no tests have been generated.

Additionally, some log output about the error would be nice to help with debugging.

FuegoArtificial commented 2 years ago

Hello Fabian,

it's indeed difficult to debug. In those cases I've usually reproduced every single step of the script using GenBI and then NUnit. With those tools it's a bit easier to figure out if there is a naming mismatch of fields, some issue with content, invalid XML or also some reserved character which needs an escape (even within some SQL-query sometimes special characters can be annoying like in ""). At least it's easier to divide and conquer until you find the issue because of the direct feedback if the generation works. Then you can improve a template or whatever causes the issue accordingly. If the generation of the test suite works, testing it in NUnit gives you proper error messages.

It might not be what you are looking for, but maybe it helps.

fdw commented 2 years ago

Thanks for the help, @FuegoArtificial! The main problem is that we can get Genbi.exe to work locally, but not on our agent. So at least the input seems good enough, but even there, we can't be sure.

However, we had a look at Genbi's source and found the right place to at least change the return code: In PlayMacroCommand

        public void ExecuteQuiet(string filename)
        {
            try
            {
                var generator = new TestSuiteGenerator();
                generator.Load(filename);
                generator.Execute();
            }
            catch
            {
                return;
            }
        }

There, errors are silently caught and dropped. Instead, something like Environment.Exit(9) would help. Additionally, we could think about writing the error to a log file, or to include logging of some sort. But I'd like to have @Seddryck's opinion before I'd start implementing something.

Seddryck commented 2 years ago

Yes surely, it's the right place to fix the issue. If you want to write to a log file I would create a new IMacroOutput interface witha method AppendText that the MacroWindow would be implementing but also a new FileLogOutput class.

All pull requests are welcome!

Davijde commented 1 year ago

Hi All, as I faced the same issue I though about a workaround for this.

I put everything into this PR - https://github.com/Seddryck/NBi/pull/702

Hope it helps :)

Seddryck commented 1 year ago

Improvements part of 1.24 with PR #710 and available as 1.24.0-beta0018