Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Test Priority in xUnit and also to run selective test based on Priority

Tags:

c#

xunit.net

I have 2 questions here:

  1. How to set Priority of Tests in xUnit

  2. How to run selective tests based on Priority

E.g i have 5 tests : T1,T2,T3,T4,T5 having Priorities P1,P2,P1,P2,P3

So I need to run only P1 cases i.e T1,T3 how to do that ?

like image 825
user522170 Avatar asked Oct 20 '22 08:10

user522170


1 Answers

You can get that by adding Trait attributes to your test.

More info is outlined here:

  • https://devblogs.microsoft.com/devops/part-2using-traits-with-different-test-frameworks-in-the-unit-test-explorer/
  • http://mariangemarcano.blogspot.dk/2010/12/xunitnet-running-tests-testcategory.html?m=1)
like image 156
Christian Horsdal Avatar answered Oct 23 '22 02:10

Christian Horsdal