[AMSDK-10056] Adds e2e tests for AEPExperiencePlatform extension#48
[AMSDK-10056] Adds e2e tests for AEPExperiencePlatform extension#48
Conversation
code/functionalTests/AEPExperiencePlatformFunctionalTests.swift
Outdated
Show resolved
Hide resolved
| super.setUp() | ||
| FunctionalTestUtils.resetUserDefaults() | ||
| continueAfterFailure = false | ||
| if AEPExperiencePlatformFunctionalTests.firstRun { |
There was a problem hiding this comment.
I'm wondering if this would be cleaner if FunctionalTestBase contained a method firstRun() which is called from FunctionalTestBase.setUp()? Each test class can then override func firstRun() with this first run logic. I think it would be easier for developers to add this logic to a firstRun() method instead of needed to implement this if block.
There was a problem hiding this comment.
one solution would be to move these steps on the class setUp method, but it requires the framework APIs to be static which I wanted to avoid, it feels more convenient to have them on the instance and call them directly. Not sure how I feel about having another method firstRun on top of class setUp 🤔
There was a problem hiding this comment.
I still feel it would be cleaner to separate the "first run" logic from the "run for every test" logic. However, we can think about it more with we need to implement more functional tests if you'd like.
Another issue: is it possible to use FunctionTestBase.firstRun instead of defining your own variable? Maybe create a public readonly property isFirstRun ?
There was a problem hiding this comment.
Changed based on your last comment. We might be able to define a protocol and add methods we want child classes to implement, but I would not include those changes as part of this pr.
|
|
||
| guard let eventData = experiencePlatformEvent.asDictionary() else { | ||
| ACPCore.log(ACPMobileLogLevel.debug, tag: LOG_TAG, message:"Failed to dispatch the event because the event data is nil.") | ||
| guard let xdmData = experiencePlatformEvent.xdm, !xdmData.isEmpty, let eventData = experiencePlatformEvent.asDictionary() else { |
code/functionalTests/AEPExperiencePlatformFunctionalTests.swift
Outdated
Show resolved
Hide resolved
|
|
||
| extension Int { | ||
| init(_ val:Bool) { | ||
| self = val ? 1 : 0 |
There was a problem hiding this comment.
What's the use of this? Are you seeing that Ints 1 & 0 are being converted to booleans after being serialized through the Event Hub?
There was a problem hiding this comment.
just the events come out of order each time, and since I only had two events I used true/false to check the order 😆 is it too confusing?
Codecov Report
@@ Coverage Diff @@
## dev #48 +/- ##
==========================================
+ Coverage 71.34% 77.90% +6.57%
==========================================
Files 29 29
Lines 949 973 +24
==========================================
+ Hits 677 758 +81
+ Misses 272 215 -57 |
kevinlind
left a comment
There was a problem hiding this comment.
Added another minor comment, but overall this looks great.
Description
Adds e2e tests for AEPExperiencePlatform extension covering the main flows with:
Fixed a bug where the request event was dispatched when xdm data was empty [:]
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: