Comments (4)
Hey @JinhongZh,
Thats an interesting use case. I did a quick test using method.DeclaringType.Assembly.Location
rather than StackFrame.GetFileName()
and I found that it unfortunately won't work.
method.DeclaringType.Assembly.Location
returns the location of the dll which is the compiled code. Snapper needs to store the snapshots next to the code file not the generated dll.
Would it be possible for you to make an example project where this issue occurs and I can use that to figure out a solution.
from snapper.
Hi @theramis ,
Thanks for your swift reply :)
Yes, our use case is a bit special. We are trying to deploy a set of services in different environment, and we want to run the same snapshot tests against the services in those environments. Due to there are some parameters need to be updated accordingly, we have a PowerShell script to update the settings file first, and then execute the snapshot tests via "dotnet vstest XXTest.dll". Those all worked fine, until in one of the projects, where the setup was done in C# code, to keep the same workflow as it always do, we tried to execute the PowerShell script from the there, and then we hit the problem where the StackFrame.GetFileName() didn't work.
For packaging the snapshot test project nuget, we simply take the output from the dotnetcore publish folder and insert them as contentFiles (nuspec file), in this way we can inspect the folder layout and use the files directly when the nuget is been installed in the new project.
I will try to make an example project as you suggested, and let you know when it is ready.
Thanks :)
from snapper.
Hi again,
I tried to created two example projects to reproduce the problem we are facing, and then I found there were a problem when directly using the PowerShell class from System.Management.Automation nuget. The discovery made me think the way of executing the dll via Powershell might not be the best fit in this case. After I modified the project to use cmd.exe to execute the snapshot test dll, the problem went away.
I don't think there is a need to dig further in this special usage of the Snapper.
Thanks for the great tool by the way :)
from snapper.
Hi,
I've also run in this problem. It might be related to this:
dotnet/coreclr#14696
from snapper.
Related Issues (20)
- Add support of self referencing loop HOT 3
- [BUG] ShouldUpdateSnapshot does not respect SnapshotSettings HOT 1
- Support NUnit v4
- Support non json HOT 5
- Approach to Environment.NewLine HOT 6
- Use Custom DSL instead of Inheriting NUnit.Framework.Is HOT 5
- Allow exclusion of fields HOT 2
- Create snapshot on first run if none exists HOT 1
- Add support for Specflow
- Custom update snapshot attributes HOT 2
- Allow customising the serializer settings for Snapshots HOT 2
- Add alternative snapshots for decimal values HOT 4
- Serializing non json values HOT 2
- SnapshotDoesNotExistException on Azure Pipelines ubuntu-20.04 Agent HOT 4
- Plain text serialization HOT 4
- Snapshot created with different serialization settings HOT 6
- Enable changing only the snapshot filename HOT 6
- Support NExpect HOT 9
- Support for Unity Test Framework HOT 5
- Remove support for .net 45 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snapper.