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

[DNM] [WIP] run tests in separate threads #15189

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

pinzart90
Copy link
Contributor

@pinzart90 pinzart90 commented May 3, 2024

In this PR:
With this PR I am trying to ensure that no async tasks will bleed from one test to another, because test will now run on separate threads. Tests are still synchronous (i.e not parallel) but on separate threads where we can better isolate tasks from one another.

Problem:
Async tasks are still bleeding from on test to another. I was not able to catch or interrupt tasks that are not started in the currently executing test.
Ex:

async void DoStuff() { await Task.Delay(1000); SomePointer.DoMoreStuff() }

Test1 {
   SomePointer = new SomePointer();
   DoStuff();
   SomePointer = null;
} 

Test2 {
  // Do whatever
  DoStuff might get executed now and crash because SomePointer is now null.
}

@pinzart90 pinzart90 changed the title run tests in separate threads [DNM] run tests in separate threads May 3, 2024
Copy link

github-actions bot commented May 3, 2024

UI Smoke Tests

Test: success. 2 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests - net8.0

@pinzart90 pinzart90 changed the title [DNM] run tests in separate threads [DNM] [WIP] run tests in separate threads May 3, 2024
return new IsolatedTestCommand(command);
}
}

Copy link
Contributor Author

@pinzart90 pinzart90 May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main code change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are those threads reused in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Each thread will be disposed after it is used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, looks like there is cross thread access to the UI, probably some static UI resources or something similar…

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are lots of static events and static singletons now. It's good for all of us to keep in mind that even if we don't intend to create multiple instances of a type in a shipped product we might need to do so during testing.

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

Successfully merging this pull request may close these issues.

3 participants