Skip to content
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

Unit tests for breadcrumb serialisation (if possible) #4000

Open
jamescrosswell opened this issue Feb 24, 2025 · 0 comments
Open

Unit tests for breadcrumb serialisation (if possible) #4000

jamescrosswell opened this issue Feb 24, 2025 · 0 comments

Comments

@jamescrosswell
Copy link
Collaborator

          > @jamescrosswell I'm not sure how we would unit test these. Thoughts? The value coming from native is a string. I don't see anyway to simulate all error conditions from native at this time either.

We may not have bulletproof unit tests but perfect is the enemy of good, as they say.

Ultimately this method takes a JsonElement as input. It should be possible to test the method with various different inputs.

In the most basic case, that could be a JsonElement representing some JSON produced by the sentry-dotnet SDK when we serialize a breadcrumb.

For this particular change, it would also be good to test it with the JSON for a breadcrumb that had been serialised using the Native SDK. Worst case, we simply run one of our sample apps and capture that JSON in the console/debug logs then copy/paste into a test. Ideally we could run the most recent version of the Native code during the test to serialise one or more breadcrumbs to JSON and then parse that... which would ensure we were always testing against the JSON produced by the same version of the Native SDK that we embed with sentry-dotnet. Those would obviously have to be device tests.

Originally posted by @jamescrosswell in #3993 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant