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

Update adapter json test framework to validate BidVideo #3835

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

laurb9
Copy link
Contributor

@laurb9 laurb9 commented Jul 31, 2024

Adapter json test framework appears to ignore the expectedBid.video object and so the related tests do not test anything.

Add expectedBid.Video and diff function to validate this part of the adapter response. There are a few tests that only have video.duration and no video.primary_category and those would fail; we can update the tests or update the ExtPrebidVideo structure to make them optional.

Here I update the structure assuming that the tests show the intention, but if that's not desirable we could update the tests instead.

There's a similar issue with exchange tests that I will look to address separately.

Fixes the existing adapter tests including the one added in #3834 so they actually do validate the expected response.

There are a few tests that do not specify `primary_category` and would have failed; we can update the tests or update the structure. Here I update the structure assuming that the tests show the intention.
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 588862b

adapterstest

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:23:	BidOnTags			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:33:	SampleBid			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:46:	VerifyStringValue		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:53:	VerifyIntValue			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:60:	VerifyBoolValue			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/adapter_test_util.go:67:	VerifyBannerSize		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:69:		RunJSONBidderTest		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:82:		RunSingleJSONBidderTest		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:104:		loadFile			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:126:		runSpec				0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:134:		getTestExtraRequestInfo		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:184:		expectsErrors			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:193:		ToRequestData			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:214:		ToResponseData			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:243:		assertMakeRequestsOutput	0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:261:		assertErrorList			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:282:		assertMakeBidsOutput		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:302:		diffHttpRequests		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:337:		diffBids			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:352:		diffOrtbBids			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:365:		diffBidVideo			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:376:		diffJson			0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:414:		testMakeRequestsImpl		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:435:		getDataRaceTestCopies		0.0%
github.com/prebid/prebid-server/v2/adapters/adapterstest/test_json.go:456:		testMakeBidsImpl		0.0%
total:											(statements)			0.0%

Comment on lines 77 to 78
Duration int `json:"duration,omitempty"`
PrimaryCategory string `json:"primary_category,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
I think we need to fix unit tests instead. Here is why:

  1. We will not hide known issues in unit tests.
  2. We will not modify core structures to satisfy unit tests.
  3. We will have unit tests in this PR that will show how to use this new feature and set an examples for future contributors.

I only had to fix 3 files to make unit tests pass:
/adapters/freewheelssp/freewheelssptest/exemplary/multi-imp.json
/adapters/yeahmobi/yeahmobitest/exemplary/simple-video.json
/adapters/pubmatic/pubmatictest/exemplary/video.json

Change in adapter json tests is expected here. I'll confirm this with the team just in case :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, pushed another commit efd1719 to fix adapter tests and remove the change in bid.go

Copy link
Collaborator

@hhhjort hhhjort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bsardo bsardo changed the title Fix adapter json test framework to include BidVideo Update adapter json test framework to validate BidVideo Sep 12, 2024
@bsardo bsardo merged commit 7613ff5 into prebid:master Sep 12, 2024
5 checks passed
@laurb9 laurb9 deleted the fix-tests-video branch September 12, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants