1. Thomas Rolseth
  2. SnapDevelop
  3. Thursday, 24 October 2019

We are using xUnit for our unit tests.  Tests – very simple ones – will often fail with the attached error when doing a 'Run All Tests' operation.  And it is random.  If I select the failed test that is highlighted below and do a 'Run Selected Test' it will pass.  If I perform a ‘Run All Tests’ operation again, the tests that fail will be different than the previous attempt.  The error suggests that it can’t find the datawindow but both the cs version of it and the srd are in the project.  It also exists in the config file (attached).  Am I doing something incorrectly here or this this possibly a bug?

I have set the ‘Copy to Output’ properly to Copy Always for all our datawindows (attached)

Thanks, Tom

 

Attachments (3)
Thomas Rolseth Accepted Answer Pending Moderation
0
Votes
Undo

Logan, 

The xUnit test project uses .net core as does the main web api project it is linked to.  In the startup class, we have this line of code:

            // Parse DWs
            DataObjectFactory.LoadDataWindow(null);

 

Comment
Hi Tom,

Could you send your sample project here?

Regards, Logan
  1. Logan Liu
  2. Monday, 28 October 2019
There are no comments made yet.
  1. Friday, 25 October 2019
  2. SnapDevelop
  3. # 1
Logan Liu Accepted Answer Pending Moderation
0
Votes
Undo

Hi Tom,

In SnapDevelop, if you create a ASP.Net Core Web API project, there will be an app.UseDataWindow() in StartUp.cs by default, it will parse all DataWindows when starting up.

If you create a xUnit project which is not ASP.Net Core Web API project, before initiating a DataStore object, please call the DataObjectFactory.LoadDataWindowLazy() method or the DataObjectFactory. LoadDataWindow() method to parse the DataWindows registered in .pbw files.

The DataObjectFactory.LoadDataWindowLazy() method only parses each DataWindow when used. And the DataObjectFactory.LoadDataWindow() method parses all DataWindows at one time.

If you still can't solve it, I suggest that you send the sample source code here.

Regards, Logan

Comment
There are no comments made yet.
  1. Friday, 25 October 2019
  2. SnapDevelop
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.