D
D
DD-var2021-08-01 18:04:57
ASP.NET
DD-var, 2021-08-01 18:04:57

How to set priority when executing XUnit?

I wrote tests to check requests, there was a problem when you run them automatically, they start working out of order. How can this be solved and is it possible to set a priority?

[Fact]
        public async Task GetUsers()
        {
            try
            {
                // Arrange 
                var response = await _factory.Client.GetAsync("GetUsers");
                var responseBody = await response.Content.ReadAsStringAsync();
                var jObject = JObject.Parse(responseBody);
                //var jObject = JsonConvert.DeserializeObject(responseBody);
                var token = JObject.Parse(jObject.ToString());
                var isUser = token["Users"].Count() > 0 ? true : false;
                // Assert  
                
                // Assert.True(succeeded);
                Assert.True(isUser);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question