Hello everyone.
I plan to create a login user window that shows up before the test plan is loaded, or simply when Editor.exe is started.
This is to prevent unauthorized people from modifying the test plan.
My project in Visual Studio is created as a class library, so there is no entry point (Main() etc…) to create the form. I’m using launchSettings.json where I define launching the Editor.exe startup file
Is there a way to show the user login window as the first step when Editor.exe is launched?
I recommend creating a new panel where the user can log in. Then you can fail test plan execution if the user is not logging using a result listener like this:
[Display("User Must Be Logged In panel", Group: "")]
public class TestPlanBlockTest : ITapDockPanel
{
static ResultListener blockListener = new BlockResultListener();
class BlockResultListener : ResultListener
{
[Display("User not logged in")]
class UserNotLoggedInMessage
{
[Browsable(true)]
[Layout(LayoutMode.FullRow)]
public string Message { get; } = "User not logged in!";
}
public override void OnTestPlanRunStart(TestPlanRun planRun)
{
base.OnTestPlanRunStart(planRun);
var missingLogin = new UserNotLoggedInMessage();
UserInput.Request(missingLogin);
// check planRun.Hash if it doesnt match, it has been tampered with.
// abort the plan main thread.
planRun.MainThread.Abort();
}
}
public FrameworkElement CreateElement(ITapDockContext context)
{
if(context.ResultListeners.Contains(blockListener) == false)
context.ResultListeners.Add(new BlockResultListener());
return new TextBlock
{
Text = "This will cause the test plan to fail"
};
}
public double? DesiredWidth
{
get;
}
public double? DesiredHeight
{
get;
}
}
That’s an interesting solution and thanks for the quick reply! Unfortunately, this does not prevent people from modifying the test steps, such as changing some value, voltage, etc. and then saving the changes. This solution will only prevent the test from running. Or am i wrong? Thanks for response.
You are right, it does not prevent the users from modifying the test plan directly, but you could check the hash of the test plan against some database to verify that nothing has been changed.
Additionally, you could also make some operator panel and then use panel layout, presets and “Focus mode” to make it harder for the operator to edit things they are not supposed to.