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

CI Build should run UnitTests #277

Closed
rdeveen opened this issue Jan 27, 2022 · 13 comments · Fixed by #417
Closed

CI Build should run UnitTests #277

rdeveen opened this issue Jan 27, 2022 · 13 comments · Fixed by #417
Assignees
Labels
enhancement Idea of improvement of existing feature. good first issue Good for newcomers
Milestone

Comments

@rdeveen
Copy link
Contributor

rdeveen commented Jan 27, 2022

What's the Problem?

The automated build does not run the Unit Tests.

Solution/Idea

Change the Azure Pipelines to automaticly run the Unit Tests on every build.

Alternatives

(remove the tests ;))

Priorities

Capability Priority
This proposal will allow developers to use a better DevToys Must

DevToys Version

No response

Comments

No response

@veler
Copy link
Collaborator

veler commented Jan 27, 2022

Definitely! I didn't do it so far because we were using a CI plan with a limited amount of minutes, but now that this repo use a CI plan with unlimited minutes and that we have more contributors, I agree the CI should run the tests!

@veler veler added enhancement Idea of improvement of existing feature. good first issue Good for newcomers labels Jan 27, 2022
@veler veler added this to the v1.0.3.0 milestone Jan 31, 2022
@rlm96
Copy link
Contributor

rlm96 commented Jan 31, 2022

@veler I can take this one :)

@veler
Copy link
Collaborator

veler commented Feb 13, 2022

@veler I can take this one :)

Hello @rlm96 , sorry for the late response. Sure thing, feel free to try this one out :)

@veler veler modified the milestones: v1.0.3.0, v1.1.0.0 Feb 13, 2022
@rlm96
Copy link
Contributor

rlm96 commented Feb 15, 2022

Hello, an update: I'm using @veler branch, the .yml files seemed to be correct so I tried to run .\vstest.console.exe using ...\DevToys.Tests.build.appxrecipe file. It failed (something similar to this vstest issue):

The active test run was aborted. Reason: Unable to communicate with test host process.
Closing app with package full name 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_1.0.0.0_x64__amhbm8v6a514r'.

Test Run Aborted with error System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---.
Total tests: Unknown
     Passed: 152
 Total time: 29.0509 Seconds

That's probably the reason the build has failed.

@astegi-dev
Copy link
Contributor

For me, when I build with Release configuration, the unit tests fail for some reason.
The error message is the same as what is logged in the build:
DEP7100: Failed to activate app 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_amhbm8v6a514r!vstest.executionengine.universal.App' with parameters '--port 63354 --endpoint 127.0.0.1:063354 --role client --parentprocessid 4164 --datacollectionport 63353 --telemetryoptedin false'. COMException - The text associated with this error code could not be found.

However, if I build with Debug configuration, the unit tests can be executed. Might worth a try setting the Debug configuration in the CI.

@veler
Copy link
Collaborator

veler commented Feb 19, 2022

However, if I build with Debug configuration, the unit tests can be executed. Might worth a try setting the Debug configuration in the CI.

Perhaps it's acceptable to run unit tests only in Debug configuration? That would require the CI to build in Debug and Release mode, but it should be fine. Debug build is quite fast compared to Release. @rlm96 , would you like to try that?

@rlm96
Copy link
Contributor

rlm96 commented Feb 19, 2022

@veler - The failure explained in my previous comment was with Debug configuration. @astegi-dev - Did all your test finished succesfully with Debug configuration using vstest.exe?

We can try to use the Debug config in the pipeline but as it is failing in our locals I'm not sure it will fix the pipeline build

@veler
Copy link
Collaborator

veler commented Feb 19, 2022

Ah, makes sense! Let's try to make it work on the local machine first before trying in the CI then.

@rlm96
Copy link
Contributor

rlm96 commented Feb 19, 2022

Btw, also tried to launch vstest using the build with Release config and got the same error:

DeployAsync: END (Success, 0:00:03.84)
Deployment operation succeeded, package moniker: 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_1.0.0.0_x64__amhbm8v6a514r'.
Deploy: END (Success, 0:00:03.856)
Attempting to launch app with app user model Id 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_amhbm8v6a514r!vstest.executionengine.universal.App' and arguments '--port 56182 --endpoint 127.0.0.1:056182 --role client --parentprocessid 9868 --telemetryoptedin false'.
DEP7100: Failed to activate app 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_amhbm8v6a514r!vstest.executionengine.universal.App' with parameters '--port 56182 --endpoint 127.0.0.1:056182 --role client --parentprocessid 9868 --telemetryoptedin false'. COMException - The text associated with this error code could not be found.

The text associated with this error code could not be found. [0x80040904]
App activation failed.
Failed to initialize client proxy: could not connect to test process.
Closing app with package full name 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_1.0.0.0_x64__amhbm8v6a514r'.

Test Run Aborted.

Probably those errors (Debug and Release) may be related, thoughts?

@astegi-dev
Copy link
Contributor

astegi-dev commented Feb 19, 2022

At first, the vstest.console.exe gave me errors as well. But then, I updated as many nuget packages as I could. After that, the test execution with Release configuration still fail, but with the Debug show no errors; all-green via console execution.
image

@rlm96
Copy link
Contributor

rlm96 commented Feb 20, 2022

@astegi-dev Indeed, so I think what is making the tests fail are MSTest.TestAdapter and MSTest.TestFramework references. I updated only both packages to 2.2.8 version and the tests passed. @veler should we update those dependencies and then try again to build in Azure DevOps (with Debug config, I also tried with Release and still failing as mentioned by @astegi-dev)?

@rlm96 rlm96 mentioned this issue Feb 20, 2022
12 tasks
@veler
Copy link
Collaborator

veler commented Feb 20, 2022

That's interesting! Thank you for finding this out! Yes, definitely, let's try this out. 😊

@veler veler linked a pull request Feb 20, 2022 that will close this issue
12 tasks
@veler
Copy link
Collaborator

veler commented Feb 20, 2022

Thank you so much @astegi-dev and @rlm96 ! It works great now 😁😁😁

@veler veler modified the milestones: v1.1.0.0, v1.0.4.0 Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea of improvement of existing feature. good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants