Testing ASP.NET Core 2.1 on .NET
up vote
-1
down vote
favorite
I build ASP.NET 2.1 solution based on .NET Framework 4.7.2 cause of dependencies of older packages that I am integrated with.
My solution looks that
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
I started to write down second project with is class based on Framework 4.7.2
I started looking for some test approach that can wired up my server and perform test. I Found that ASP.NET Core 2.1 provides Microsoft.AspNetCore.Mvc.Testing
so I configure my test, but when I want to to wired up my app its problem with deps
.
Project.deps.json'. This file is required for functional tests to run
properly. There should be a copy of the file on your source project
bin folder. If that is not the case, make sure that the property
PreserveCompilationContext is set to true on your project file. E.g
'true'. For
functional tests to work they need to either run from the build output
folder or the Project.deps.json file from your
application's output directory must be copied to the folder where the
tests are running on. A common cause for this error is having shadow
copying enabled when the tests run.
My question is, if Microsoft.AspNetCore.Mvc.Testing
is build upon metadata Microsoft.AspNetCore.App
is some another option I can perform test on real WebApi that is a Core project targeting net472?
I putted below my class that call my API
/// <summary>
/// One instance of this will be created per test collection
/// </summary>
public class TestHostFixture : ICollectionFixture<WebApplicationFactory<Startup>>
{
public readonly HttpClient Client;
public TestHostFixture()
{
var factory = new WebApplicationFactory<Startup>();
Client = factory.CreateClient();
}
}
c# asp.net asp.net-core-2.1 web-api-testing
add a comment |
up vote
-1
down vote
favorite
I build ASP.NET 2.1 solution based on .NET Framework 4.7.2 cause of dependencies of older packages that I am integrated with.
My solution looks that
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
I started to write down second project with is class based on Framework 4.7.2
I started looking for some test approach that can wired up my server and perform test. I Found that ASP.NET Core 2.1 provides Microsoft.AspNetCore.Mvc.Testing
so I configure my test, but when I want to to wired up my app its problem with deps
.
Project.deps.json'. This file is required for functional tests to run
properly. There should be a copy of the file on your source project
bin folder. If that is not the case, make sure that the property
PreserveCompilationContext is set to true on your project file. E.g
'true'. For
functional tests to work they need to either run from the build output
folder or the Project.deps.json file from your
application's output directory must be copied to the folder where the
tests are running on. A common cause for this error is having shadow
copying enabled when the tests run.
My question is, if Microsoft.AspNetCore.Mvc.Testing
is build upon metadata Microsoft.AspNetCore.App
is some another option I can perform test on real WebApi that is a Core project targeting net472?
I putted below my class that call my API
/// <summary>
/// One instance of this will be created per test collection
/// </summary>
public class TestHostFixture : ICollectionFixture<WebApplicationFactory<Startup>>
{
public readonly HttpClient Client;
public TestHostFixture()
{
var factory = new WebApplicationFactory<Startup>();
Client = factory.CreateClient();
}
}
c# asp.net asp.net-core-2.1 web-api-testing
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
I wanted to perform integration test on running software by test frameworkMicrosoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usinOwin
test server. I am pushed to rewrite project toWebApi 2.2
and useOwin
andOwin
test server to perform somexUnit
test. I was pretty sure that if I can target against newCore
framework that I could use test features as well.
– Adrian Botor
Nov 11 at 20:43
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I build ASP.NET 2.1 solution based on .NET Framework 4.7.2 cause of dependencies of older packages that I am integrated with.
My solution looks that
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
I started to write down second project with is class based on Framework 4.7.2
I started looking for some test approach that can wired up my server and perform test. I Found that ASP.NET Core 2.1 provides Microsoft.AspNetCore.Mvc.Testing
so I configure my test, but when I want to to wired up my app its problem with deps
.
Project.deps.json'. This file is required for functional tests to run
properly. There should be a copy of the file on your source project
bin folder. If that is not the case, make sure that the property
PreserveCompilationContext is set to true on your project file. E.g
'true'. For
functional tests to work they need to either run from the build output
folder or the Project.deps.json file from your
application's output directory must be copied to the folder where the
tests are running on. A common cause for this error is having shadow
copying enabled when the tests run.
My question is, if Microsoft.AspNetCore.Mvc.Testing
is build upon metadata Microsoft.AspNetCore.App
is some another option I can perform test on real WebApi that is a Core project targeting net472?
I putted below my class that call my API
/// <summary>
/// One instance of this will be created per test collection
/// </summary>
public class TestHostFixture : ICollectionFixture<WebApplicationFactory<Startup>>
{
public readonly HttpClient Client;
public TestHostFixture()
{
var factory = new WebApplicationFactory<Startup>();
Client = factory.CreateClient();
}
}
c# asp.net asp.net-core-2.1 web-api-testing
I build ASP.NET 2.1 solution based on .NET Framework 4.7.2 cause of dependencies of older packages that I am integrated with.
My solution looks that
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
I started to write down second project with is class based on Framework 4.7.2
I started looking for some test approach that can wired up my server and perform test. I Found that ASP.NET Core 2.1 provides Microsoft.AspNetCore.Mvc.Testing
so I configure my test, but when I want to to wired up my app its problem with deps
.
Project.deps.json'. This file is required for functional tests to run
properly. There should be a copy of the file on your source project
bin folder. If that is not the case, make sure that the property
PreserveCompilationContext is set to true on your project file. E.g
'true'. For
functional tests to work they need to either run from the build output
folder or the Project.deps.json file from your
application's output directory must be copied to the folder where the
tests are running on. A common cause for this error is having shadow
copying enabled when the tests run.
My question is, if Microsoft.AspNetCore.Mvc.Testing
is build upon metadata Microsoft.AspNetCore.App
is some another option I can perform test on real WebApi that is a Core project targeting net472?
I putted below my class that call my API
/// <summary>
/// One instance of this will be created per test collection
/// </summary>
public class TestHostFixture : ICollectionFixture<WebApplicationFactory<Startup>>
{
public readonly HttpClient Client;
public TestHostFixture()
{
var factory = new WebApplicationFactory<Startup>();
Client = factory.CreateClient();
}
}
c# asp.net asp.net-core-2.1 web-api-testing
c# asp.net asp.net-core-2.1 web-api-testing
edited Nov 8 at 19:49
asked Nov 8 at 18:48
Adrian Botor
298313
298313
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
I wanted to perform integration test on running software by test frameworkMicrosoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usinOwin
test server. I am pushed to rewrite project toWebApi 2.2
and useOwin
andOwin
test server to perform somexUnit
test. I was pretty sure that if I can target against newCore
framework that I could use test features as well.
– Adrian Botor
Nov 11 at 20:43
add a comment |
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
I wanted to perform integration test on running software by test frameworkMicrosoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usinOwin
test server. I am pushed to rewrite project toWebApi 2.2
and useOwin
andOwin
test server to perform somexUnit
test. I was pretty sure that if I can target against newCore
framework that I could use test features as well.
– Adrian Botor
Nov 11 at 20:43
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
I wanted to perform integration test on running software by test framework
Microsoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usin Owin
test server. I am pushed to rewrite project to WebApi 2.2
and use Owin
and Owin
test server to perform some xUnit
test. I was pretty sure that if I can target against new Core
framework that I could use test features as well.– Adrian Botor
Nov 11 at 20:43
I wanted to perform integration test on running software by test framework
Microsoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usin Owin
test server. I am pushed to rewrite project to WebApi 2.2
and use Owin
and Owin
test server to perform some xUnit
test. I was pretty sure that if I can target against new Core
framework that I could use test features as well.– Adrian Botor
Nov 11 at 20:43
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214283%2ftesting-asp-net-core-2-1-on-net%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You cannot use .NET Core packages on a .NET Framework project, check out this question: stackoverflow.com/questions/48539730/…
– obl
Nov 8 at 22:32
I understand, but I don't see any opportunity to test WebApi. That is what I am looking for.
– Adrian Botor
Nov 9 at 18:06
Well depending on what kind of testing you want to do, you should be able to find a tool for it. One such tool is Swagger. You could also use xUnit for unit testing.
– obl
Nov 9 at 18:40
I wanted to perform integration test on running software by test framework
Microsoft.AspNetCore.Mvc.Testing
. I used to do some test before in other app usinOwin
test server. I am pushed to rewrite project toWebApi 2.2
and useOwin
andOwin
test server to perform somexUnit
test. I was pretty sure that if I can target against newCore
framework that I could use test features as well.– Adrian Botor
Nov 11 at 20:43