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

New Feature: Direct Agent Execution #1624

Open
wants to merge 1 commit into
base: version4
Choose a base branch
from
Open

Conversation

CharliePoole
Copy link
Member

@CharliePoole CharliePoole commented Feb 9, 2025

Fixes #1623

Copy link
Member

@manfred-brands manfred-brands left a comment

Choose a reason for hiding this comment

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

I don't think this new code is part of the testing as I don't see it in build.cake or package-tests.cake but I'm not clear on how the tester is tested.

Comment on lines +90 to +95
#else
var attrs = assembly?.GetCustomAttributes(typeof(TAttr), false);
return attrs.Length > 0
? attrs[0] as TAttr
: null;
#endif
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any TargetFramework that would get to the #else case.


public void WriteSummaryReport(XmlNode resultNode)
{
var OverallResult = resultNode.GetAttribute("result") ?? "Unknown";
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't local variable start with lower case?
This value is already obtained before this method is called so could be passed as a parameter.


private void WriteErrorsFailuresAndWarnings(XmlNode resultNode)
{
string resultState = resultNode.GetAttribute("result") ?? "";
Copy link
Member

Choose a reason for hiding this comment

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

"result" node could be passed in like in summary.

Comment on lines +230 to +231
if (resultNode.SelectSingleNode("reason/message")?.InnerText == "One or more child tests had warnings" ||
resultNode.SelectSingleNode("failure/message")?.InnerText == "One or more child tests had errors")
Copy link
Member

Choose a reason for hiding this comment

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

Most likely pre-existing, but this is a hard dependency on a string in another repository.

#endif
var xmlResult = runner.Run(null, TestFilter.Empty).Xml;

WriteRunSettingsReport(xmlResult);
Copy link
Member

Choose a reason for hiding this comment

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

Would like to see a separate report class.
Is it the idea that the nunit-console calls this class as otherwise we have two report classes.

#if NETFRAMEWORK
string agentExe = agentAssembly;
#else
string agentExe = Path.ChangeExtension(agentAssembly, ".exe");
Copy link
Member

Choose a reason for hiding this comment

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

Is nunit-console to be supported on non-windows? The NUnitConsole_Linux.sln has not been maintained.

On Linux there is no .exe extension.

Copy link
Member Author

Choose a reason for hiding this comment

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

It should continue to be supported. Some linux distros support exe but not all. Let's add an issue for this.

#else
const string STANDARD_CONFIG_FILE = "nunit.engine.core.tests.dll.config";
#endif
const string STANDARD_CONFIG_FILE = "nunit.agent.core.tests.exe.config";
Copy link
Member

Choose a reason for hiding this comment

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

Compiling this branch, I see the previous behaviour:

$ find . -name 'nunit.agent.core.tests*.config'
./net462/nunit.agent.core.tests.exe.config
./net8.0/nunit.agent.core.tests.dll.config

@CharliePoole
Copy link
Member Author

The DirectTestAgent isn't part of the engine but of the tests. It just provides an exe to allow exercising the direct execution facility in nunit.agent.core. There's only one unit test that uses it right now but once the agents are in separate projects, all their tests will be run through it. We have never tested the agents in isolation before but this makes a start.

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.

2 participants