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

RunOnce doesn't seem to work #663

Closed
fdw opened this issue Oct 26, 2021 · 6 comments
Closed

RunOnce doesn't seem to work #663

fdw opened this issue Oct 26, 2021 · 6 comments

Comments

@fdw
Copy link

fdw commented Oct 26, 2021

I'm trying to run several tests with a shared setup that only needs to run once, before all tests (as the tests don't change the data). According to the docs, I can write something like this:

 <group name="Groupname">
    <setup>
      <tasks run-once="true">
        <sql-run name="Testsetup.sql" path="."/>
      </tasks>
    </setup>
    <test name="Test 1">
...

While the setup is executed, it looks to me like the run-once is ignored - the setup is run once for every test!

To find out whether I used the tag wrong, I had a look at the actual implementation. I think I found the problem, but I'm not really sure, so take the following with a large grain of salt:

In TestSuite.cs, the check for RunOnce looks like this:

var skip = false;
if (command is IGroupCommand)
{
    var groupCommand = (command as IGroupCommand);
    if (groupCommand.RunOnce)
        skip = groupCommand.HasRun;
}

However, command is a IGroupCommandArgs, so it cannot be a IGroupCommand. Additionally, IGroupCommandArgs does not have a RunOnce attribute.
Update: I can't even find another reference to IGroupCommand :(

Did I use run-once correctly? Is it working, or is my interpretation of the code correct?

@Seddryck
Copy link
Owner

Seddryck commented Oct 31, 2021

You are probably right that run-once is suffering from a bug. I've not checked in-depth but was able to reproduce. I'll take a look but probably not this week.

@Seddryck Seddryck added the bug label Nov 7, 2021
@Seddryck Seddryck self-assigned this Nov 7, 2021
@Seddryck Seddryck added this to the v1.23 milestone Nov 7, 2021
@Seddryck
Copy link
Owner

It was not really a single bug but many of them pilling up. I added many unit tests around this run-once for setup but won't have time to properly check if it's working end-to-end. Your feedback will be welcome on version 1.23.0-beta0192.

@fdw
Copy link
Author

fdw commented Nov 22, 2021

Probably I'm doing something wrong, but I cannot get the latest beta to work. Starting with 1.23.0-beta0172, I only get the error that Dynamitey, Version=2.0.9.136 is missing - but I cannot find anything referencing it.

@Seddryck
Copy link
Owner

Ok, will check tonight. Potentially something wrong in the packaging.

@Seddryck
Copy link
Owner

Seddryck commented Nov 22, 2021

Huuuum, I tried to download the framework and it's working fine on my side.
Ok, I got it by adding a setup to my test. Dynamitey is required by ImpromptuInterface, required for running some stuffs in the code for setup/cleanup (that I'm currently removing on v2.0). I will check why it's not in the packaging.

@Seddryck
Copy link
Owner

I fixed the issue around Dynamitey in the version 1.0.23-beta.195 available here

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