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
appSetting.Json is not getting copied to SpeclowPlusRunner Folder #1668
Comments
I cant make it work with Pre and Post build because I am running my Test Cases in a Docker Container inside a Linux machine. |
Why do you need the |
While running the tests through SpecRun, code which requires appsetting.json wont be executed as it try to find the json file in SpecFlowPlusRunner folder and it wont be available there if not placed explicitly. When it doesnt find the json file inside SpecRunner folder it gives an error which says cannot find appsetting.json |
Could you create a small project where we can reproduce the issue? This would help us to analyse this issue. |
@SabotageAndi I have encountered this issue as well. I've set up a small sample repo at https://github.com/tparikka/SpecFlowRunnerPlusAppSettingsIssue that you can download and run that shows the problem. The issue is that content like app settings files need to exist in the same directory as the binary executes from. Items like appsettings are copied to |
I had a look at this issue in the last days. So you can't simply say "appsettings.json" in accessing the file. We provide an API to get the folder where the test assembly is. It's in the TestRunContext (https://specflow.org/plus/documentation/TestRunContext/) class. I adjusted our ASP.NET Core example (https://github.com/SpecFlowOSS/SpecFlow-Examples/tree/master/ASP.NET-MVC/BookShop) as an example of how you can use it. @tparikka & @zeeshankhan0330 it this information unblocking you? |
Thanks !!
…On Fri, Feb 21, 2020, 8:24 PM Andreas Willich ***@***.***> wrote:
I had a look at this issue in the last days.
The issue exists, if you are using the Process test thread isolation. In
SharedAppDomain this works.
The reason is that for the process isolation, we have a separate binary
that is in its own folder. We have to set the working directory to this
folder, because of .NET Core assembly loading.
So you can't simply say "appsettings.json" in accessing the file. We
provide an API to get the folder where the test assembly is. It's in the
TestRunContext (https://specflow.org/plus/documentation/TestRunContext/)
class.
I adjusted our ASP.NET Core example (
https://github.com/SpecFlowOSS/SpecFlow-Examples/tree/master/ASP.NET-MVC/BookShop)
as an example of how you can use it.
There we use the ConfigurationBuilder. It is here:
https://github.com/SpecFlowOSS/SpecFlow-Examples/blob/master/ASP.NET-MVC/BookShop/BookShop.AcceptanceTests/Hooks/Hooks.cs#L26
@tparikka <https://github.com/tparikka> & @zeeshankhan0330
<https://github.com/zeeshankhan0330> it this information unblocking you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1668?email_source=notifications&email_token=AEOYUKKLBXZWFG5HOIAS4P3RD7TLTA5CNFSM4IE2AYP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMS6URA#issuecomment-589687364>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEOYUKITEV6PKBTQOK2MZELRD7TLTANCNFSM4IE2AYPQ>
.
|
Because of inactivity and I think I have answered it, I am closing this issue. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
appSetting.Json is not getting copied to SpeclowPlusRunner Folder
SpecFlow Version:
Used Test Runner
Version number: 3.0.352
Project Format of the SpecFlow project
packages.config
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation
NuGet packageSpecFlowSingleFileGenerator
custom toolVisual Studio Version
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settingsAre the latest Visual Studio updates installed?
<Major>.<Minor>.<Patch>
.NET Framework:
Test Execution Method:
<SpecFlow> Section in app.config or content of specflow.json
Repro Project
Issue Description
WHile I Build the project, appsetting.json file is not getting copied into SpecflowPlusRunner folder. Hence test wont get run which are dependent on this json file.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: