Show winform during unit test

I am having trouble displaying winform during unit test. I use this as a user-tested testing procedure to show the user 2 different image segments captured during the Selenium user interface testing and the difference between them and allow the user to pass or issue a test based on whether the images are too different.

I created a form with 2 PictureBox elements and added methods to the form so that the form can take the images I need and upload them to the PictureBox, and then show the form.

I tried searching google + SO and I cannot find any similar questions regarding this.

In my test, I:

var compareForm = new PlotCompare.PlotCompare();
compareForm.Add_Original_Image(image1);
compareForm.Add_Diff_Image(imageDiff);
compareForm.Show();

but the call .Show();does not display the form.

The only problem that I can reasonably think of is that the project I'm using is a class library, because all it has is tests and therefore does not have a function mainthat I can access.

Would thank for any help, thanks in advance.

+1
source share
1 answer

fooobar.com/questions/1624185 / ... Responding to this, essentially setting the ShowInTaskbarform property False, it will display as expected!

I also had to use .ShowDialog(), not just.Show()

+1
source

Source: https://habr.com/ru/post/1624188/


All Articles