From 2420589ef992cb798b0cd7cc460b77392881672f Mon Sep 17 00:00:00 2001 From: sheng <277715243@qq.com> Date: Wed, 26 Aug 2020 17:49:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20sdk=E6=B5=8B=E9=87=8F=E5=8D=8F=E8=AE=AE3?= =?UTF-8?q?.0=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=95=B4=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E4=BF=AE=E6=94=B9=E5=91=BD=E5=90=8D=E8=A7=84?= =?UTF-8?q?=E5=88=99=EF=BC=8C=E5=8E=BB=E6=8E=89=E9=83=A8=E5=88=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BD=BF=E7=94=A8=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Example/Example.xcodeproj/project.pbxproj | 239 ++++----- Example/Example/AppDelegate.m | 8 - .../GIOCollectionViewController.m | 61 +-- .../GIOLabelAttributeViewController.m | 55 +- .../PageStructure/GIOBaseViewController.m | 11 - .../GIOChildsAddViewController.m | 23 +- .../PageStructure/GIOPresentViewController.m | 10 - Example/ExampleTests/GrowingIO_ExampleTests.m | 27 +- .../ExampleTests/Helper/GrowingTestHelper.m | 17 +- .../ExampleTests/Helper/ManualTrackHelper.h | 22 +- .../ExampleTests/Helper/ManualTrackHelper.m | 15 +- .../ExampleTests/Helper/NoburPoMeaProCheck.h | 20 +- .../ExampleTests/Helper/NoburPoMeaProCheck.m | 140 ++--- .../ManualTrackTest/AppVarEventsTest.h | 13 - .../ManualTrackTest/AppVarEventsTest.m | 507 ------------------ .../ManualTrackTest/CS1ManualTrackTest.m | 45 -- ...Test.h => ConversionVariablesEventsTest.h} | 2 +- ...Test.m => ConversionVariablesEventsTest.m} | 193 +------ .../{CstmEventsTest.h => CustomEventsTest.h} | 2 +- .../{CstmEventsTest.m => CustomEventsTest.m} | 214 +------- ...Test.h => LoginUserAttributerEventsTest.h} | 2 +- ...Test.m => LoginUserAttributerEventsTest.m} | 78 +-- ...ventsTest.h => PageAttributesEventsTest.h} | 2 +- .../PageAttributesEventsTest.m | 40 ++ .../ManualTrackTest/PvarEventsTest.m | 496 ----------------- ...tsTest.h => VisitorAttributesEventsTest.h} | 2 +- .../VisitorAttributesEventsTest.m | 50 ++ .../ManualTrackTest/VstrEventsTest.m | 184 ------- .../A1TrackAPIMainThreadTest.m | 0 .../DailyDataLimit.h | 0 .../ExampleTests/MethodTest/DailyDataLimit.m | 30 ++ .../FlushIntervalAPITest.h | 0 .../MethodTest/FlushIntervalAPITest.m | 22 + .../GDPRTest.h | 0 .../GDPRTest.m | 15 +- .../GetConfigurationTest.m | 0 .../GetEnableLogTest.h | 0 .../GetEnableLogTest.m | 6 - .../GetIDsTest.h | 0 .../GetIDsTest.m | 7 - .../MediatorTest.m | 0 .../TrackViewTest.h | 0 .../ExampleTests/MethodTest/TrackViewTest.m | 32 ++ .../ClickEventsTest.h} | 2 +- .../ProtocolAndApi/ClickEventsTest.m | 200 +++++++ .../ProtocolAndApi/PageEventsTest.m | 50 ++ .../ViewChangeEventsTest.h} | 2 +- .../ProtocolAndApi/ViewChangeEventsTest.m | 74 +++ .../VisitorEventsTest.h} | 2 +- .../ProtocolAndApi/VisitorEventsTest.m | 53 ++ .../SDK Method Test/DailyDataLimit.m | 62 --- .../SDK Method Test/FlushIntervalAPITest.m | 63 --- .../SDK Method Test/TrackViewTest.m | 70 --- .../ChgEventsTest.m | 185 ------- .../ClckEventsTest.m | 503 ----------------- .../VstEventsTest.m | 214 -------- .../pageEventsTest.m | 117 ---- .../GrowingActionEvent/GrowingActionEvent.m | 16 +- .../GrowingActionEventElement.h | 21 +- .../GrowingActionEventElement.m | 40 +- .../GrowingIMPTrack/GrowingIMPTrack.m | 153 +++--- GrowingTracker/Event/GrowingCustomField.m | 2 +- GrowingTracker/Event/GrowingEvent.h | 2 + .../Event/GrowingPageEvent/GrowingPageEvent.h | 6 +- .../Event/GrowingPageEvent/GrowingPageEvent.m | 18 +- GrowingTracker/Event/GrowingVisitEvent.m | 13 +- 66 files changed, 975 insertions(+), 3483 deletions(-) delete mode 100644 Example/ExampleTests/ManualTrackTest/AppVarEventsTest.h delete mode 100644 Example/ExampleTests/ManualTrackTest/AppVarEventsTest.m rename Example/ExampleTests/ManualTrackTest/{EvarEventsTest.h => ConversionVariablesEventsTest.h} (75%) rename Example/ExampleTests/ManualTrackTest/{EvarEventsTest.m => ConversionVariablesEventsTest.m} (62%) rename Example/ExampleTests/ManualTrackTest/{CstmEventsTest.h => CustomEventsTest.h} (80%) rename Example/ExampleTests/ManualTrackTest/{CstmEventsTest.m => CustomEventsTest.m} (60%) rename Example/ExampleTests/ManualTrackTest/{PPLEventsTest.h => LoginUserAttributerEventsTest.h} (75%) rename Example/ExampleTests/ManualTrackTest/{PPLEventsTest.m => LoginUserAttributerEventsTest.m} (76%) rename Example/ExampleTests/ManualTrackTest/{PvarEventsTest.h => PageAttributesEventsTest.h} (77%) create mode 100644 Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.m delete mode 100644 Example/ExampleTests/ManualTrackTest/PvarEventsTest.m rename Example/ExampleTests/ManualTrackTest/{VstrEventsTest.h => VisitorAttributesEventsTest.h} (76%) create mode 100644 Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.m delete mode 100644 Example/ExampleTests/ManualTrackTest/VstrEventsTest.m rename Example/ExampleTests/{SDK Method Test => MethodTest}/A1TrackAPIMainThreadTest.m (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/DailyDataLimit.h (100%) create mode 100644 Example/ExampleTests/MethodTest/DailyDataLimit.m rename Example/ExampleTests/{SDK Method Test => MethodTest}/FlushIntervalAPITest.h (100%) create mode 100644 Example/ExampleTests/MethodTest/FlushIntervalAPITest.m rename Example/ExampleTests/{SDK Method Test => MethodTest}/GDPRTest.h (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GDPRTest.m (78%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GetConfigurationTest.m (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GetEnableLogTest.h (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GetEnableLogTest.m (76%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GetIDsTest.h (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/GetIDsTest.m (79%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/MediatorTest.m (100%) rename Example/ExampleTests/{SDK Method Test => MethodTest}/TrackViewTest.h (100%) create mode 100644 Example/ExampleTests/MethodTest/TrackViewTest.m rename Example/ExampleTests/{protocol test and api test/ClckEventsTest.h => ProtocolAndApi/ClickEventsTest.h} (80%) create mode 100644 Example/ExampleTests/ProtocolAndApi/ClickEventsTest.m create mode 100644 Example/ExampleTests/ProtocolAndApi/PageEventsTest.m rename Example/ExampleTests/{protocol test and api test/ChgEventsTest.h => ProtocolAndApi/ViewChangeEventsTest.h} (78%) create mode 100644 Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.m rename Example/ExampleTests/{protocol test and api test/VstEventsTest.h => ProtocolAndApi/VisitorEventsTest.h} (79%) create mode 100644 Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.m delete mode 100644 Example/ExampleTests/SDK Method Test/DailyDataLimit.m delete mode 100644 Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.m delete mode 100644 Example/ExampleTests/SDK Method Test/TrackViewTest.m delete mode 100644 Example/ExampleTests/protocol test and api test/ChgEventsTest.m delete mode 100644 Example/ExampleTests/protocol test and api test/ClckEventsTest.m delete mode 100644 Example/ExampleTests/protocol test and api test/VstEventsTest.m delete mode 100644 Example/ExampleTests/protocol test and api test/pageEventsTest.m diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index d489ee569..c278d94b8 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -93,6 +93,19 @@ 0465315E24DD4272002D254C /* GIOListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0465311D24DD4271002D254C /* GIOListTableViewCell.m */; }; 0465315F24DD4272002D254C /* GIOListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0465311E24DD4271002D254C /* GIOListTableViewCell.xib */; }; 0465316024DD4272002D254C /* GIOButtonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0465312024DD4271002D254C /* GIOButtonViewController.m */; }; + 047BF3A924F638BB0028FE94 /* MediatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF39C24F638BB0028FE94 /* MediatorTest.m */; }; + 047BF3AA24F638BB0028FE94 /* GetIDsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF39F24F638BB0028FE94 /* GetIDsTest.m */; }; + 047BF3AB24F638BB0028FE94 /* GDPRTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A024F638BB0028FE94 /* GDPRTest.m */; }; + 047BF3AC24F638BB0028FE94 /* TrackViewTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A124F638BB0028FE94 /* TrackViewTest.m */; }; + 047BF3AD24F638BB0028FE94 /* A1TrackAPIMainThreadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A224F638BB0028FE94 /* A1TrackAPIMainThreadTest.m */; }; + 047BF3AE24F638BB0028FE94 /* FlushIntervalAPITest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A324F638BB0028FE94 /* FlushIntervalAPITest.m */; }; + 047BF3AF24F638BB0028FE94 /* DailyDataLimit.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A424F638BB0028FE94 /* DailyDataLimit.m */; }; + 047BF3B024F638BB0028FE94 /* GetEnableLogTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A624F638BB0028FE94 /* GetEnableLogTest.m */; }; + 047BF3B124F638BB0028FE94 /* GetConfigurationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3A824F638BB0028FE94 /* GetConfigurationTest.m */; }; + 047BF3B424F6551B0028FE94 /* VisitorEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3B324F6551B0028FE94 /* VisitorEventsTest.m */; }; + 047BF3BA24F655A50028FE94 /* ClickEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3B624F655A50028FE94 /* ClickEventsTest.m */; }; + 047BF3BB24F655A50028FE94 /* ViewChangeEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3B724F655A50028FE94 /* ViewChangeEventsTest.m */; }; + 047BF3BC24F655A50028FE94 /* PageEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 047BF3B924F655A50028FE94 /* PageEventsTest.m */; }; 04A6FAF224E662E9006C72F0 /* GIOChildsAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A6FAF124E662E9006C72F0 /* GIOChildsAddViewController.m */; }; 04A6FAF524E67215006C72F0 /* GIOBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A6FAF424E67215006C72F0 /* GIOBaseViewController.m */; }; 4916270F24E157BB00444AF2 /* GIOPresentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4916270E24E157BB00444AF2 /* GIOPresentViewController.m */; }; @@ -104,26 +117,12 @@ 4962653C24DA66B600032551 /* GrowingTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962653524DA66B600032551 /* GrowingTestHelper.m */; }; 4962653D24DA66B600032551 /* NoburPoMeaProCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962653624DA66B600032551 /* NoburPoMeaProCheck.m */; }; 4962653E24DA66B600032551 /* NSURLSession+TestHook.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962653724DA66B600032551 /* NSURLSession+TestHook.m */; }; - 4962656624DA66BF00032551 /* A1TrackAPIMainThreadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654224DA66BF00032551 /* A1TrackAPIMainThreadTest.m */; }; - 4962656724DA66BF00032551 /* MediatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654324DA66BF00032551 /* MediatorTest.m */; }; - 4962656824DA66BF00032551 /* GetIDsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654624DA66BF00032551 /* GetIDsTest.m */; }; - 4962656924DA66BF00032551 /* GDPRTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654724DA66BF00032551 /* GDPRTest.m */; }; - 4962656A24DA66BF00032551 /* TrackViewTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654824DA66BF00032551 /* TrackViewTest.m */; }; - 4962656B24DA66BF00032551 /* FlushIntervalAPITest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654924DA66BF00032551 /* FlushIntervalAPITest.m */; }; - 4962656C24DA66BF00032551 /* DailyDataLimit.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654A24DA66BF00032551 /* DailyDataLimit.m */; }; - 4962656D24DA66BF00032551 /* GetEnableLogTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654C24DA66BF00032551 /* GetEnableLogTest.m */; }; - 4962656E24DA66BF00032551 /* GetConfigurationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962654E24DA66BF00032551 /* GetConfigurationTest.m */; }; - 4962656F24DA66BF00032551 /* EvarEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655224DA66BF00032551 /* EvarEventsTest.m */; }; - 4962657024DA66BF00032551 /* VstrEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655424DA66BF00032551 /* VstrEventsTest.m */; }; - 4962657124DA66BF00032551 /* CstmEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655724DA66BF00032551 /* CstmEventsTest.m */; }; + 4962656F24DA66BF00032551 /* ConversionVariablesEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655224DA66BF00032551 /* ConversionVariablesEventsTest.m */; }; + 4962657024DA66BF00032551 /* VisitorAttributesEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655424DA66BF00032551 /* VisitorAttributesEventsTest.m */; }; + 4962657124DA66BF00032551 /* CustomEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655724DA66BF00032551 /* CustomEventsTest.m */; }; 4962657224DA66BF00032551 /* CS1ManualTrackTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655824DA66BF00032551 /* CS1ManualTrackTest.m */; }; - 4962657324DA66BF00032551 /* PPLEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655A24DA66BF00032551 /* PPLEventsTest.m */; }; - 4962657424DA66BF00032551 /* AppVarEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655C24DA66BF00032551 /* AppVarEventsTest.m */; }; - 4962657524DA66BF00032551 /* PvarEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655D24DA66BF00032551 /* PvarEventsTest.m */; }; - 4962657624DA66BF00032551 /* VstEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655F24DA66BF00032551 /* VstEventsTest.m */; }; - 4962657724DA66BF00032551 /* ClckEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962656024DA66BF00032551 /* ClckEventsTest.m */; }; - 4962657824DA66BF00032551 /* pageEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962656324DA66BF00032551 /* pageEventsTest.m */; }; - 4962657924DA66BF00032551 /* ChgEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962656524DA66BF00032551 /* ChgEventsTest.m */; }; + 4962657324DA66BF00032551 /* LoginUserAttributerEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655A24DA66BF00032551 /* LoginUserAttributerEventsTest.m */; }; + 4962657524DA66BF00032551 /* PageAttributesEventsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4962655D24DA66BF00032551 /* PageAttributesEventsTest.m */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; @@ -236,6 +235,28 @@ 0465312124DD4271002D254C /* GIOHybridViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GIOHybridViewController.h; sourceTree = ""; }; 0465312224DD4271002D254C /* GIOSimpleUIElemtsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GIOSimpleUIElemtsViewController.h; sourceTree = ""; }; 0465312324DD4271002D254C /* GIOActionSheetViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GIOActionSheetViewController.h; sourceTree = ""; }; + 047BF39A24F638BB0028FE94 /* DailyDataLimit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DailyDataLimit.h; sourceTree = ""; }; + 047BF39B24F638BB0028FE94 /* FlushIntervalAPITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlushIntervalAPITest.h; sourceTree = ""; }; + 047BF39C24F638BB0028FE94 /* MediatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MediatorTest.m; sourceTree = ""; }; + 047BF39D24F638BB0028FE94 /* TrackViewTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackViewTest.h; sourceTree = ""; }; + 047BF39E24F638BB0028FE94 /* GetEnableLogTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetEnableLogTest.h; sourceTree = ""; }; + 047BF39F24F638BB0028FE94 /* GetIDsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetIDsTest.m; sourceTree = ""; }; + 047BF3A024F638BB0028FE94 /* GDPRTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GDPRTest.m; sourceTree = ""; }; + 047BF3A124F638BB0028FE94 /* TrackViewTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TrackViewTest.m; sourceTree = ""; }; + 047BF3A224F638BB0028FE94 /* A1TrackAPIMainThreadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A1TrackAPIMainThreadTest.m; sourceTree = ""; }; + 047BF3A324F638BB0028FE94 /* FlushIntervalAPITest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlushIntervalAPITest.m; sourceTree = ""; }; + 047BF3A424F638BB0028FE94 /* DailyDataLimit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DailyDataLimit.m; sourceTree = ""; }; + 047BF3A524F638BB0028FE94 /* GetIDsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetIDsTest.h; sourceTree = ""; }; + 047BF3A624F638BB0028FE94 /* GetEnableLogTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetEnableLogTest.m; sourceTree = ""; }; + 047BF3A724F638BB0028FE94 /* GDPRTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GDPRTest.h; sourceTree = ""; }; + 047BF3A824F638BB0028FE94 /* GetConfigurationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetConfigurationTest.m; sourceTree = ""; }; + 047BF3B224F6551B0028FE94 /* VisitorEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitorEventsTest.h; sourceTree = ""; }; + 047BF3B324F6551B0028FE94 /* VisitorEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VisitorEventsTest.m; sourceTree = ""; }; + 047BF3B524F655A50028FE94 /* ClickEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClickEventsTest.h; sourceTree = ""; }; + 047BF3B624F655A50028FE94 /* ClickEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClickEventsTest.m; sourceTree = ""; }; + 047BF3B724F655A50028FE94 /* ViewChangeEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewChangeEventsTest.m; sourceTree = ""; }; + 047BF3B824F655A50028FE94 /* ViewChangeEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewChangeEventsTest.h; sourceTree = ""; }; + 047BF3B924F655A50028FE94 /* PageEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageEventsTest.m; sourceTree = ""; }; 04A6FAE024E2BF11006C72F0 /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; 04A6FAF024E662E8006C72F0 /* GIOChildsAddViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIOChildsAddViewController.h; sourceTree = ""; }; 04A6FAF124E662E9006C72F0 /* GIOChildsAddViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIOChildsAddViewController.m; sourceTree = ""; }; @@ -262,42 +283,18 @@ 4962653624DA66B600032551 /* NoburPoMeaProCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoburPoMeaProCheck.m; sourceTree = ""; }; 4962653724DA66B600032551 /* NSURLSession+TestHook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURLSession+TestHook.m"; sourceTree = ""; }; 4962653824DA66B600032551 /* ManualTrackHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManualTrackHelper.h; sourceTree = ""; }; - 4962654024DA66BF00032551 /* DailyDataLimit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DailyDataLimit.h; sourceTree = ""; }; - 4962654124DA66BF00032551 /* FlushIntervalAPITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlushIntervalAPITest.h; sourceTree = ""; }; - 4962654224DA66BF00032551 /* A1TrackAPIMainThreadTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A1TrackAPIMainThreadTest.m; sourceTree = ""; }; - 4962654324DA66BF00032551 /* MediatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MediatorTest.m; sourceTree = ""; }; - 4962654424DA66BF00032551 /* TrackViewTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackViewTest.h; sourceTree = ""; }; - 4962654524DA66BF00032551 /* GetEnableLogTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetEnableLogTest.h; sourceTree = ""; }; - 4962654624DA66BF00032551 /* GetIDsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetIDsTest.m; sourceTree = ""; }; - 4962654724DA66BF00032551 /* GDPRTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GDPRTest.m; sourceTree = ""; }; - 4962654824DA66BF00032551 /* TrackViewTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TrackViewTest.m; sourceTree = ""; }; - 4962654924DA66BF00032551 /* FlushIntervalAPITest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlushIntervalAPITest.m; sourceTree = ""; }; - 4962654A24DA66BF00032551 /* DailyDataLimit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DailyDataLimit.m; sourceTree = ""; }; - 4962654B24DA66BF00032551 /* GetIDsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetIDsTest.h; sourceTree = ""; }; - 4962654C24DA66BF00032551 /* GetEnableLogTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetEnableLogTest.m; sourceTree = ""; }; - 4962654D24DA66BF00032551 /* GDPRTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GDPRTest.h; sourceTree = ""; }; - 4962654E24DA66BF00032551 /* GetConfigurationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GetConfigurationTest.m; sourceTree = ""; }; 4962655024DA66BF00032551 /* CS1ManualTrackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CS1ManualTrackTest.h; sourceTree = ""; }; - 4962655124DA66BF00032551 /* CstmEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CstmEventsTest.h; sourceTree = ""; }; - 4962655224DA66BF00032551 /* EvarEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EvarEventsTest.m; sourceTree = ""; }; - 4962655324DA66BF00032551 /* AppVarEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppVarEventsTest.h; sourceTree = ""; }; - 4962655424DA66BF00032551 /* VstrEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VstrEventsTest.m; sourceTree = ""; }; - 4962655524DA66BF00032551 /* PPLEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PPLEventsTest.h; sourceTree = ""; }; - 4962655624DA66BF00032551 /* PvarEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PvarEventsTest.h; sourceTree = ""; }; - 4962655724DA66BF00032551 /* CstmEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CstmEventsTest.m; sourceTree = ""; }; + 4962655124DA66BF00032551 /* CustomEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomEventsTest.h; sourceTree = ""; }; + 4962655224DA66BF00032551 /* ConversionVariablesEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConversionVariablesEventsTest.m; sourceTree = ""; }; + 4962655424DA66BF00032551 /* VisitorAttributesEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VisitorAttributesEventsTest.m; sourceTree = ""; }; + 4962655524DA66BF00032551 /* LoginUserAttributerEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginUserAttributerEventsTest.h; sourceTree = ""; }; + 4962655624DA66BF00032551 /* PageAttributesEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAttributesEventsTest.h; sourceTree = ""; }; + 4962655724DA66BF00032551 /* CustomEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomEventsTest.m; sourceTree = ""; }; 4962655824DA66BF00032551 /* CS1ManualTrackTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CS1ManualTrackTest.m; sourceTree = ""; }; - 4962655924DA66BF00032551 /* EvarEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvarEventsTest.h; sourceTree = ""; }; - 4962655A24DA66BF00032551 /* PPLEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PPLEventsTest.m; sourceTree = ""; }; - 4962655B24DA66BF00032551 /* VstrEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VstrEventsTest.h; sourceTree = ""; }; - 4962655C24DA66BF00032551 /* AppVarEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppVarEventsTest.m; sourceTree = ""; }; - 4962655D24DA66BF00032551 /* PvarEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PvarEventsTest.m; sourceTree = ""; }; - 4962655F24DA66BF00032551 /* VstEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VstEventsTest.m; sourceTree = ""; }; - 4962656024DA66BF00032551 /* ClckEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ClckEventsTest.m; sourceTree = ""; }; - 4962656124DA66BF00032551 /* ChgEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChgEventsTest.h; sourceTree = ""; }; - 4962656224DA66BF00032551 /* ClckEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClckEventsTest.h; sourceTree = ""; }; - 4962656324DA66BF00032551 /* pageEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = pageEventsTest.m; sourceTree = ""; }; - 4962656424DA66BF00032551 /* VstEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VstEventsTest.h; sourceTree = ""; }; - 4962656524DA66BF00032551 /* ChgEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChgEventsTest.m; sourceTree = ""; }; + 4962655924DA66BF00032551 /* ConversionVariablesEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConversionVariablesEventsTest.h; sourceTree = ""; }; + 4962655A24DA66BF00032551 /* LoginUserAttributerEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginUserAttributerEventsTest.m; sourceTree = ""; }; + 4962655B24DA66BF00032551 /* VisitorAttributesEventsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitorAttributesEventsTest.h; sourceTree = ""; }; + 4962655D24DA66BF00032551 /* PageAttributesEventsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageAttributesEventsTest.m; sourceTree = ""; }; 6003F58A195388D20070C39A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -506,15 +503,51 @@ path = View; sourceTree = ""; }; + 047BF38D24F6379B0028FE94 /* ProtocolAndApi */ = { + isa = PBXGroup; + children = ( + 047BF3B524F655A50028FE94 /* ClickEventsTest.h */, + 047BF3B624F655A50028FE94 /* ClickEventsTest.m */, + 047BF3B924F655A50028FE94 /* PageEventsTest.m */, + 047BF3B824F655A50028FE94 /* ViewChangeEventsTest.h */, + 047BF3B724F655A50028FE94 /* ViewChangeEventsTest.m */, + 047BF3B224F6551B0028FE94 /* VisitorEventsTest.h */, + 047BF3B324F6551B0028FE94 /* VisitorEventsTest.m */, + ); + path = ProtocolAndApi; + sourceTree = ""; + }; + 047BF39924F638BA0028FE94 /* MethodTest */ = { + isa = PBXGroup; + children = ( + 047BF3A224F638BB0028FE94 /* A1TrackAPIMainThreadTest.m */, + 047BF39A24F638BB0028FE94 /* DailyDataLimit.h */, + 047BF3A424F638BB0028FE94 /* DailyDataLimit.m */, + 047BF39B24F638BB0028FE94 /* FlushIntervalAPITest.h */, + 047BF3A324F638BB0028FE94 /* FlushIntervalAPITest.m */, + 047BF3A724F638BB0028FE94 /* GDPRTest.h */, + 047BF3A024F638BB0028FE94 /* GDPRTest.m */, + 047BF3A824F638BB0028FE94 /* GetConfigurationTest.m */, + 047BF39E24F638BB0028FE94 /* GetEnableLogTest.h */, + 047BF3A624F638BB0028FE94 /* GetEnableLogTest.m */, + 047BF3A524F638BB0028FE94 /* GetIDsTest.h */, + 047BF39F24F638BB0028FE94 /* GetIDsTest.m */, + 047BF39C24F638BB0028FE94 /* MediatorTest.m */, + 047BF39D24F638BB0028FE94 /* TrackViewTest.h */, + 047BF3A124F638BB0028FE94 /* TrackViewTest.m */, + ); + name = MethodTest; + path = ExampleTests/MethodTest; + sourceTree = ""; + }; 4962651F24DA665200032551 /* ExampleTests */ = { isa = PBXGroup; children = ( 4962652924DA667900032551 /* GrowingIO_ExampleTests.m */, 4962652C24DA66B600032551 /* Helper */, 4962652824DA667900032551 /* Info.plist */, + 047BF38D24F6379B0028FE94 /* ProtocolAndApi */, 4962654F24DA66BF00032551 /* ManualTrackTest */, - 4962655E24DA66BF00032551 /* protocol test and api test */, - 4962653F24DA66BF00032551 /* SDK Method Test */, ); path = ExampleTests; sourceTree = ""; @@ -538,68 +571,31 @@ path = Helper; sourceTree = ""; }; - 4962653F24DA66BF00032551 /* SDK Method Test */ = { - isa = PBXGroup; - children = ( - 4962654124DA66BF00032551 /* FlushIntervalAPITest.h */, - 4962654924DA66BF00032551 /* FlushIntervalAPITest.m */, - 4962654324DA66BF00032551 /* MediatorTest.m */, - 4962654424DA66BF00032551 /* TrackViewTest.h */, - 4962654824DA66BF00032551 /* TrackViewTest.m */, - 4962654B24DA66BF00032551 /* GetIDsTest.h */, - 4962654624DA66BF00032551 /* GetIDsTest.m */, - 4962654024DA66BF00032551 /* DailyDataLimit.h */, - 4962654A24DA66BF00032551 /* DailyDataLimit.m */, - 4962654524DA66BF00032551 /* GetEnableLogTest.h */, - 4962654C24DA66BF00032551 /* GetEnableLogTest.m */, - 4962654D24DA66BF00032551 /* GDPRTest.h */, - 4962654724DA66BF00032551 /* GDPRTest.m */, - 4962654224DA66BF00032551 /* A1TrackAPIMainThreadTest.m */, - 4962654E24DA66BF00032551 /* GetConfigurationTest.m */, - ); - path = "SDK Method Test"; - sourceTree = ""; - }; 4962654F24DA66BF00032551 /* ManualTrackTest */ = { isa = PBXGroup; children = ( 4962655024DA66BF00032551 /* CS1ManualTrackTest.h */, 4962655824DA66BF00032551 /* CS1ManualTrackTest.m */, - 4962655924DA66BF00032551 /* EvarEventsTest.h */, - 4962655224DA66BF00032551 /* EvarEventsTest.m */, - 4962655524DA66BF00032551 /* PPLEventsTest.h */, - 4962655A24DA66BF00032551 /* PPLEventsTest.m */, - 4962655624DA66BF00032551 /* PvarEventsTest.h */, - 4962655D24DA66BF00032551 /* PvarEventsTest.m */, - 4962655124DA66BF00032551 /* CstmEventsTest.h */, - 4962655724DA66BF00032551 /* CstmEventsTest.m */, - 4962655B24DA66BF00032551 /* VstrEventsTest.h */, - 4962655424DA66BF00032551 /* VstrEventsTest.m */, - 4962655324DA66BF00032551 /* AppVarEventsTest.h */, - 4962655C24DA66BF00032551 /* AppVarEventsTest.m */, + 4962655924DA66BF00032551 /* ConversionVariablesEventsTest.h */, + 4962655224DA66BF00032551 /* ConversionVariablesEventsTest.m */, + 4962655524DA66BF00032551 /* LoginUserAttributerEventsTest.h */, + 4962655A24DA66BF00032551 /* LoginUserAttributerEventsTest.m */, + 4962655624DA66BF00032551 /* PageAttributesEventsTest.h */, + 4962655D24DA66BF00032551 /* PageAttributesEventsTest.m */, + 4962655124DA66BF00032551 /* CustomEventsTest.h */, + 4962655724DA66BF00032551 /* CustomEventsTest.m */, + 4962655B24DA66BF00032551 /* VisitorAttributesEventsTest.h */, + 4962655424DA66BF00032551 /* VisitorAttributesEventsTest.m */, ); path = ManualTrackTest; sourceTree = ""; }; - 4962655E24DA66BF00032551 /* protocol test and api test */ = { - isa = PBXGroup; - children = ( - 4962656124DA66BF00032551 /* ChgEventsTest.h */, - 4962656524DA66BF00032551 /* ChgEventsTest.m */, - 4962656224DA66BF00032551 /* ClckEventsTest.h */, - 4962656024DA66BF00032551 /* ClckEventsTest.m */, - 4962656324DA66BF00032551 /* pageEventsTest.m */, - 4962656424DA66BF00032551 /* VstEventsTest.h */, - 4962655F24DA66BF00032551 /* VstEventsTest.m */, - ); - path = "protocol test and api test"; - sourceTree = ""; - }; 6003F581195388D10070C39A = { isa = PBXGroup; children = ( 046530BA24DD4271002D254C /* Example */, 4962651F24DA665200032551 /* ExampleTests */, + 047BF39924F638BA0028FE94 /* MethodTest */, 6003F58C195388D20070C39A /* Frameworks */, 6003F58B195388D20070C39A /* Products */, 7D103DEFD312B6151DF0F9EA /* Pods */, @@ -909,33 +905,32 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 047BF3A924F638BB0028FE94 /* MediatorTest.m in Sources */, 4962653B24DA66B600032551 /* MockEventQueue.m in Sources */, 4962653924DA66B600032551 /* LogOperHelper.m in Sources */, - 4962656924DA66BF00032551 /* GDPRTest.m in Sources */, 4962653D24DA66B600032551 /* NoburPoMeaProCheck.m in Sources */, 4962653A24DA66B600032551 /* ManualTrackHelper.m in Sources */, - 4962657824DA66BF00032551 /* pageEventsTest.m in Sources */, - 4962657724DA66BF00032551 /* ClckEventsTest.m in Sources */, + 047BF3BB24F655A50028FE94 /* ViewChangeEventsTest.m in Sources */, + 047BF3B424F6551B0028FE94 /* VisitorEventsTest.m in Sources */, + 047BF3AA24F638BB0028FE94 /* GetIDsTest.m in Sources */, + 047BF3B024F638BB0028FE94 /* GetEnableLogTest.m in Sources */, 4962653E24DA66B600032551 /* NSURLSession+TestHook.m in Sources */, 4962653C24DA66B600032551 /* GrowingTestHelper.m in Sources */, - 4962657124DA66BF00032551 /* CstmEventsTest.m in Sources */, - 4962656F24DA66BF00032551 /* EvarEventsTest.m in Sources */, - 4962657924DA66BF00032551 /* ChgEventsTest.m in Sources */, - 4962656D24DA66BF00032551 /* GetEnableLogTest.m in Sources */, - 4962657424DA66BF00032551 /* AppVarEventsTest.m in Sources */, - 4962656B24DA66BF00032551 /* FlushIntervalAPITest.m in Sources */, - 4962657624DA66BF00032551 /* VstEventsTest.m in Sources */, - 4962656E24DA66BF00032551 /* GetConfigurationTest.m in Sources */, - 4962656724DA66BF00032551 /* MediatorTest.m in Sources */, + 4962657124DA66BF00032551 /* CustomEventsTest.m in Sources */, + 047BF3AF24F638BB0028FE94 /* DailyDataLimit.m in Sources */, + 4962656F24DA66BF00032551 /* ConversionVariablesEventsTest.m in Sources */, + 047BF3AC24F638BB0028FE94 /* TrackViewTest.m in Sources */, + 047BF3B124F638BB0028FE94 /* GetConfigurationTest.m in Sources */, + 047BF3AB24F638BB0028FE94 /* GDPRTest.m in Sources */, 4962657224DA66BF00032551 /* CS1ManualTrackTest.m in Sources */, - 4962656824DA66BF00032551 /* GetIDsTest.m in Sources */, + 047BF3AE24F638BB0028FE94 /* FlushIntervalAPITest.m in Sources */, 4962652B24DA667900032551 /* GrowingIO_ExampleTests.m in Sources */, - 4962657524DA66BF00032551 /* PvarEventsTest.m in Sources */, - 4962657324DA66BF00032551 /* PPLEventsTest.m in Sources */, - 4962656A24DA66BF00032551 /* TrackViewTest.m in Sources */, - 4962657024DA66BF00032551 /* VstrEventsTest.m in Sources */, - 4962656624DA66BF00032551 /* A1TrackAPIMainThreadTest.m in Sources */, - 4962656C24DA66BF00032551 /* DailyDataLimit.m in Sources */, + 047BF3BA24F655A50028FE94 /* ClickEventsTest.m in Sources */, + 047BF3AD24F638BB0028FE94 /* A1TrackAPIMainThreadTest.m in Sources */, + 4962657524DA66BF00032551 /* PageAttributesEventsTest.m in Sources */, + 047BF3BC24F655A50028FE94 /* PageEventsTest.m in Sources */, + 4962657324DA66BF00032551 /* LoginUserAttributerEventsTest.m in Sources */, + 4962657024DA66BF00032551 /* VisitorAttributesEventsTest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/Example/AppDelegate.m b/Example/Example/AppDelegate.m index b96e8143b..b1e398903 100644 --- a/Example/Example/AppDelegate.m +++ b/Example/Example/AppDelegate.m @@ -31,17 +31,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( self.configuation = [[GrowingConfiguration alloc] initWithProjectId:kGrowingProjectId launchOptions:launchOptions]; [self.configuation setLogEnabled:YES]; self.configuation.samplingRate = 1.0; - // self.configuation.urlScheme = @"hello_url_scheme"; self.configuation.cellularDataLimit = 1; - // self.configuation.dataUploadEnabled = NO; - // self.configuation.dataTrackEnabled = NO; self.configuation.impressionScale = 1.0; - // 自定义相关host设置 - // [configuration setDataTrackHost:@"http://k8s-mobile-www.growingio.com"]; - // [configuration setWebSocketHost:@"ws://k8s-mobile-gta.growingio.com"]; - // [configuration setAdvertisementHost:@"http://k8s-mobile-www.growingio.com"]; - [Growing startWithConfiguration:self.configuation]; NSString *trackSdkVersion = [Growing getVersion]; diff --git a/Example/Example/UICategoryTests/GIOCollectionViewController.m b/Example/Example/UICategoryTests/GIOCollectionViewController.m index cecbd4db8..a8fe28dd0 100644 --- a/Example/Example/UICategoryTests/GIOCollectionViewController.m +++ b/Example/Example/UICategoryTests/GIOCollectionViewController.m @@ -7,12 +7,15 @@ // #import "GIOCollectionViewController.h" + #import "GIOCollectionViewCell.h" -@interface GIOCollectionViewController () +@interface GIOCollectionViewController () @property (nonatomic, strong) UICollectionView *mainCollectionView; -@property (nonatomic, strong) NSArray *imagesArray; +@property (nonatomic, strong) NSArray *imagesArray; @end @@ -20,7 +23,7 @@ @implementation GIOCollectionViewController - (void)viewDidLoad { [super viewDidLoad]; - + [self.view addSubview:self.mainCollectionView]; } @@ -31,20 +34,20 @@ - (void)didReceiveMemoryWarning { #pragma mark UICollectionViewDelegate, UICollectionViewDataSource -//一共有几组 --(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ - return 3 ; +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 3; } -//每组几个cell --(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ - return self.imagesArray.count ; +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.imagesArray.count; } --(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ - GIOCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"GIOCollectionViewCell" forIndexPath:indexPath]; +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView + cellForItemAtIndexPath:(NSIndexPath *)indexPath { + GIOCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"GIOCollectionViewCell" + forIndexPath:indexPath]; - NSString *title = [NSString stringWithFormat:(@"第%ld张图片"),(long)indexPath.row+1]; + NSString *title = [NSString stringWithFormat:(@"第%ld张图片"), (long)indexPath.row + 1]; [cell configWithTitle:title andIamgeName:self.imagesArray[indexPath.row]]; return cell; } @@ -57,46 +60,40 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa - (UICollectionView *)mainCollectionView { if (!_mainCollectionView) { - UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; //设置collectionView滚动方向 //[layout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; //设置headerView的尺寸大小 layout.headerReferenceSize = CGSizeMake(self.view.frame.size.width, 10); //该方法也可以设置itemSize - layout.itemSize =CGSizeMake(110, 150); - + layout.itemSize = CGSizeMake(110, 150); + _mainCollectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; _mainCollectionView.backgroundColor = [UIColor clearColor]; - - [_mainCollectionView registerNib:[UINib nibWithNibName:@"GIOCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"GIOCollectionViewCell"]; - + + [_mainCollectionView registerNib:[UINib nibWithNibName:@"GIOCollectionViewCell" bundle:nil] + forCellWithReuseIdentifier:@"GIOCollectionViewCell"]; + //注册headerView 此处的ReuseIdentifier 必须和 cellForItemAtIndexPath 方法中 一致 均为reusableView [_mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"reusableView"]; - - //4.设置代理 - _mainCollectionView.accessibilityIdentifier=@"GIOCollectionView"; + + // 4.设置代理 + _mainCollectionView.accessibilityIdentifier = @"GIOCollectionView"; _mainCollectionView.delegate = self; _mainCollectionView.dataSource = self; } - + return _mainCollectionView; } - (NSArray *)imagesArray { if (!_imagesArray) { - _imagesArray = @[@"cycle_01.jpg", - @"cycle_02.jpg", - @"cycle_03.jpg", - @"cycle_04.jpg", - @"cycle_03.jpg", - @"cycle_04.jpg", - @"cycle_05.jpg", - @"cycle_06.jpg", - @"cycle_07.jpg", - @"cycle_08.jpg"]; + _imagesArray = @[ + @"cycle_01.jpg", @"cycle_02.jpg", @"cycle_03.jpg", @"cycle_04.jpg", @"cycle_03.jpg", @"cycle_04.jpg", + @"cycle_05.jpg", @"cycle_06.jpg", @"cycle_07.jpg", @"cycle_08.jpg" + ]; } return _imagesArray; } diff --git a/Example/Example/UICategoryTests/GIOLabelAttributeViewController.m b/Example/Example/UICategoryTests/GIOLabelAttributeViewController.m index 20921013e..305d72ada 100644 --- a/Example/Example/UICategoryTests/GIOLabelAttributeViewController.m +++ b/Example/Example/UICategoryTests/GIOLabelAttributeViewController.m @@ -8,12 +8,10 @@ #import "GIOLabelAttributeViewController.h" //#import "GrowingAutoTracker.h" -#import - #import +#import - -@interface GIOLabelAttributeViewController () +@interface GIOLabelAttributeViewController () @end @implementation GIOLabelAttributeViewController @@ -32,55 +30,29 @@ - (void)didReceiveMemoryWarning { //设置alpha的值为0.005 - (IBAction)setAlphaSmall:(id)sender { - self.CheckAlpLabel.alpha=0.005; + self.CheckAlpLabel.alpha = 0.005; NSLog(@"设置alpha的值为0.005"); } //设置alpha的值为1 - (IBAction)setAlphLarge:(id)sender { - self.CheckAlpLabel.alpha=1; + self.CheckAlpLabel.alpha = 1; NSLog(@"设置alpha的值为1"); } //隐藏label - (IBAction)hiddenLabel:(id)sender { - self.CheckHiddenLabel.hidden=TRUE; + self.CheckHiddenLabel.hidden = TRUE; NSLog(@"隐藏Label标签!"); } - (IBAction)showLabel:(id)sender { - self.CheckHiddenLabel.hidden=false; + self.CheckHiddenLabel.hidden = false; NSLog(@"显示Label标签!"); } //弹出浮层测试 - (IBAction)showAlertTest:(id)sender { - //alert第一种形式 -// NSString *title = NSLocalizedString(@"A Short Title Is Best", nil); -// NSString *message = NSLocalizedString(@"A message should be a short, complete sentence.", nil); -// NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil); -// NSString *otherButtonTitleOne = NSLocalizedString(@"Choice One", nil); -// NSString *otherButtonTitleTwo = NSLocalizedString(@"Choice Two", nil); -// -// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitleOne, otherButtonTitleTwo, nil]; -// alert.window.windowLevel = 200; -// [alert show]; - - //alert第二种形式 -// UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"Alert Test" message:@"Test Alert buttton action!" preferredStyle:UIAlertControllerStyleAlert]; -// UIAlertAction *yesAction=[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){ -// NSLog(@"Click OK Button of Alert!"); -// }]; -// -// UIAlertAction *noAction=[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){ -// NSLog(@"Click Cancel Button of Alert!"); -// }]; -// [alert addAction:yesAction]; -// [alert addAction:noAction]; -// [self presentViewController:alert animated:true completion:nil]; - [self showalert]; - } --(void)showalert -{ +- (void)showalert { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"弹出式对话框相关测试!" delegate:self @@ -90,21 +62,18 @@ -(void)showalert [alert show]; } - //设置GIO不采集数据 - (IBAction)growingNotTrack:(id)sender { NSLog(@"GrowingIO 不采集点击事件!"); } //监听点击事件 代理方法 -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -{ - if (buttonIndex == 1) - { +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { + if (buttonIndex == 1) { [self showalert]; } - NSString *btnTitle = [alertView buttonTitleAtIndex:buttonIndex]; - NSLog(@"弹出框,单击了按钮:%@",btnTitle); - } + NSString *btnTitle = [alertView buttonTitleAtIndex:buttonIndex]; + NSLog(@"弹出框,单击了按钮:%@", btnTitle); +} @end diff --git a/Example/Example/UICategoryTests/PageStructure/GIOBaseViewController.m b/Example/Example/UICategoryTests/PageStructure/GIOBaseViewController.m index 95fc90189..170026dcc 100644 --- a/Example/Example/UICategoryTests/PageStructure/GIOBaseViewController.m +++ b/Example/Example/UICategoryTests/PageStructure/GIOBaseViewController.m @@ -14,7 +14,6 @@ @interface GIOBaseViewController () @implementation GIOBaseViewController - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } @@ -24,14 +23,4 @@ - (void)viewDidLoad { // Do any additional setup after loading the view. } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - @end diff --git a/Example/Example/UICategoryTests/PageStructure/GIOChildsAddViewController.m b/Example/Example/UICategoryTests/PageStructure/GIOChildsAddViewController.m index f32253536..5fd1de668 100644 --- a/Example/Example/UICategoryTests/PageStructure/GIOChildsAddViewController.m +++ b/Example/Example/UICategoryTests/PageStructure/GIOChildsAddViewController.m @@ -7,6 +7,7 @@ // #import "GIOChildsAddViewController.h" + #import "GIOBaseViewController.h" @interface GIOChildsAddViewController () @@ -17,34 +18,22 @@ @implementation GIOChildsAddViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - + CGFloat width = [UIScreen mainScreen].bounds.size.width; CGFloat height = [UIScreen mainScreen].bounds.size.height; GIOBaseViewController *A = [[GIOBaseViewController alloc] init]; A.view.frame = CGRectMake(0, 0, width, height - 200); A.view.backgroundColor = [UIColor greenColor]; - + GIOBaseViewController *B = [[GIOBaseViewController alloc] init]; - B.view.frame = CGRectMake(0, height - 200, width,200); + B.view.frame = CGRectMake(0, height - 200, width, 200); B.view.backgroundColor = [UIColor redColor]; - + [self addChildViewController:A]; [self addChildViewController:B]; - + [self.view addSubview:A.view]; [self.view addSubview:B.view]; } - - -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - @end diff --git a/Example/Example/UICategoryTests/PageStructure/GIOPresentViewController.m b/Example/Example/UICategoryTests/PageStructure/GIOPresentViewController.m index 0bdd0bb71..7afe24fbd 100644 --- a/Example/Example/UICategoryTests/PageStructure/GIOPresentViewController.m +++ b/Example/Example/UICategoryTests/PageStructure/GIOPresentViewController.m @@ -19,14 +19,4 @@ - (void)viewDidLoad { // Do any additional setup after loading the view. } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - @end diff --git a/Example/ExampleTests/GrowingIO_ExampleTests.m b/Example/ExampleTests/GrowingIO_ExampleTests.m index 8de760bc6..ca7f77901 100644 --- a/Example/ExampleTests/GrowingIO_ExampleTests.m +++ b/Example/ExampleTests/GrowingIO_ExampleTests.m @@ -28,42 +28,17 @@ - (void)afterEach { } - (void)setUp { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. self.continueAfterFailure = NO; - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } - (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. + } - (void)testExample { - // UI tests must launch the application that they test. XCUIApplication *app = [[XCUIApplication alloc] init]; [app launch]; - - // Use recording to get started writing UI tests. - // Use XCTAssert and related functions to verify your tests produce the correct results. } -//- (void)testExample { -// //构造VIEW_CHANGE事件 -// [[viewTester usingLabel:@"UserName"] enterText:@"GrowingIOUser\n"]; -// [[viewTester usingLabel:@"PassWord"] waitToBecomeFirstResponder]; -// [[viewTester usingLabel:@"PassWord"] waitForView]; -// [[viewTester usingLabel:@"PassWord"] enterText:@"GrowingIO" expectedResult:@"GrowingIO"]; -// -// //MockEventQueue 缓存事件并提供了几个高效的接口 -// NSUInteger chngEventCount = [[MockEventQueue eventsFor:@"VIEW_CHANGE"] count]; -// -// NSUInteger acvEventCount = [[MockEventQueue eventsFor:@"app_activate"] count]; -// -// //使用XCTAssert断言,该部分可参考apple 文档 -// XCTAssertEqual(chngEventCount, 1); -// XCTAssertEqual(acvEventCount, 1); -//} - @end diff --git a/Example/ExampleTests/Helper/GrowingTestHelper.m b/Example/ExampleTests/Helper/GrowingTestHelper.m index 2e7cc425d..72fffa337 100644 --- a/Example/ExampleTests/Helper/GrowingTestHelper.m +++ b/Example/ExampleTests/Helper/GrowingTestHelper.m @@ -7,25 +7,13 @@ // #import "GrowingTestHelper.h" + #import #import @implementation GrowingTestHelper -+ (void)deactivateAppForDuration:(NSTimeInterval)duration -{ - //如果kif框架此方法支持了iOS11可以去掉此判断,执行kif的方法 -// if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0) { -// UIApplication *application = [UIApplication sharedApplication]; -// [application.delegate applicationWillResignActive:application]; -// [application.delegate applicationDidEnterBackground:application]; -// [tester waitForTimeInterval:duration]; -// [application.delegate applicationWillEnterForeground:application]; -// [application.delegate applicationDidBecomeActive:application]; -// } else { -// [system deactivateAppForDuration:duration]; -// } - ++ (void)deactivateAppForDuration:(NSTimeInterval)duration { [[UIApplication sharedApplication] performSelector:@selector(suspend)]; [tester waitForTimeInterval:duration]; } @@ -35,7 +23,6 @@ + (void)reactivateApp { [tester waitForTimeInterval:1]; } -// 暴力打开某个APP = 。= 如果可以打开。直接打开不解释 // iOS11可用 + (BOOL)isOpenApp:(NSString*)appIdentifierName { Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace"); diff --git a/Example/ExampleTests/Helper/ManualTrackHelper.h b/Example/ExampleTests/Helper/ManualTrackHelper.h index fcde79614..9d2b50828 100644 --- a/Example/ExampleTests/Helper/ManualTrackHelper.h +++ b/Example/ExampleTests/Helper/ManualTrackHelper.h @@ -10,20 +10,20 @@ @interface ManualTrackHelper : NSObject //判断字典dicts是否包含关键字ckchar -+(Boolean *)CheckContainsKey:(NSDictionary *)dicts:(NSString *)ckchar; ++ (Boolean *)CheckContainsKey:(NSDictionary *)dicts:(NSString *)ckchar; -//cstm事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)CstmEventCheck:(NSDictionary *)cstmevent; +// cstm事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)customEventCheck:(NSDictionary *)cstmevent; -//ppl事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)PplEventCheck:(NSDictionary *)pplevent; +// ppl事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)PplEventCheck:(NSDictionary *)pplevent; -//pvar事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)PvarEventCheck:(NSDictionary *)pvarevent; +// pvar事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)PvarEventCheck:(NSDictionary *)pvarevent; -//evar事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)EvarEventCheck:(NSDictionary *)evarevent; +// evar事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)EvarEventCheck:(NSDictionary *)evarevent; -//vstr事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)VstrEventCheck:(NSDictionary *)vstrevent; +// vstr事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)visitorEventCheck:(NSDictionary *)vstrevent; @end diff --git a/Example/ExampleTests/Helper/ManualTrackHelper.m b/Example/ExampleTests/Helper/ManualTrackHelper.m index dc90bda64..57c99e346 100644 --- a/Example/ExampleTests/Helper/ManualTrackHelper.m +++ b/Example/ExampleTests/Helper/ManualTrackHelper.m @@ -23,15 +23,9 @@ + (Boolean *)CheckContainsKey:(NSDictionary *)dicts:(NSString *)ckchar { return FALSE; } -// cstm事件对比,测量协议字段完整且每个字段不为空 -+ (NSDictionary *)CstmEventCheck:(NSDictionary *)cstmevent { +// custom事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)customEventCheck:(NSDictionary *)cstmevent { NSDictionary *cstmchres; - // NSArray * - // cstmprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"pageShowTimestamp",@"domain",@"eventName",@"num",@"globalSequenceId",@"eventSequenceId",@"attributes",@"userId"]; - //重构代码后,废弃ptm字段 2018-07-23 - // NSArray * - // cstmprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"eventName",@"num",@"globalSequenceId",@"eventSequenceId",@"attributes",@"userId"]; - // SDK重构2.5.0,调整测量协议 2018-08-09 NSArray *cstmprome = @[ @"userId", @"sessionId", @"eventType", @"timestamp", @"pageName", @"domain", @"eventName", @"num", @"attributes", @"userId", @"globalSequenceId", @"eventSequenceId" @@ -50,9 +44,6 @@ + (NSDictionary *)CstmEventCheck:(NSDictionary *)cstmevent { // ppl事件对比,测量协议字段完整且每个字段不为空 + (NSDictionary *)PplEventCheck:(NSDictionary *)pplevent { NSDictionary *pplchres; - // NSArray * - // pplprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"globalSequenceId",@"eventSequenceId",@"attributes",@"userId"]; - // SDK重构2.5.0,调整测量协议 2018-08-09 NSArray *pplprome = @[ @"userId", @"sessionId", @"eventType", @"timestamp", @"domain", @"attributes", @"userId", @"globalSequenceId", @"eventSequenceId" @@ -105,7 +96,7 @@ + (NSDictionary *)EvarEventCheck:(NSDictionary *)evarevent { } // vstr事件对比,测量协议字段完整且每个字段不为空 -+ (NSDictionary *)VstrEventCheck:(NSDictionary *)vstrevent { ++ (NSDictionary *)visitorEventCheck:(NSDictionary *)vstrevent { NSDictionary *vstrchres; NSArray *vstrprome = @[ @"userId", @"sessionId", @"eventType", @"timestamp", @"domain", @"attributes", @"userId" ]; //对比测量协议结构 diff --git a/Example/ExampleTests/Helper/NoburPoMeaProCheck.h b/Example/ExampleTests/Helper/NoburPoMeaProCheck.h index f12e1564b..c8310288a 100644 --- a/Example/ExampleTests/Helper/NoburPoMeaProCheck.h +++ b/Example/ExampleTests/Helper/NoburPoMeaProCheck.h @@ -14,20 +14,20 @@ + (BOOL)isBlankString:(NSString *)aStr; //对比两个NSArray -+(NSDictionary *)ComNSArray:(NSArray *)arr1:(NSArray *)arr2; ++ (NSDictionary *)ComNSArray:(NSArray *)arr1:(NSArray *)arr2; //判断NSDictionary是否存在空关键字 -+(NSDictionary *)CheckDictEmpty:(NSDictionary *)ckdict; ++ (NSDictionary *)CheckDictEmpty:(NSDictionary *)ckdict; -//Vst事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)VstEventCheck:(NSDictionary *)vstevent; +// Vst事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)visitEventCheck:(NSDictionary *)vstevent; -//clck事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ClckEventCheck:(NSDictionary *)clckevent; +// clck事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)clickEventCheck:(NSDictionary *)clckevent; -//VIEW_CHANGE事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ChngEventCheck:(NSDictionary *)chngevent; +// VIEW_CHANGE事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)viewChangeEventCheck:(NSDictionary *)chngevent; -//imp事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ImpEventCheck:(NSDictionary *)impevent; +// imp事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)ImpEventCheck:(NSDictionary *)impevent; @end diff --git a/Example/ExampleTests/Helper/NoburPoMeaProCheck.m b/Example/ExampleTests/Helper/NoburPoMeaProCheck.m index 4caf46391..e2c83dd54 100644 --- a/Example/ExampleTests/Helper/NoburPoMeaProCheck.m +++ b/Example/ExampleTests/Helper/NoburPoMeaProCheck.m @@ -11,7 +11,6 @@ @implementation NoburPoMeaProCheck //字段串是否为空 + (BOOL)isBlankString:(NSString *)aStr { - //NSLog(@"****check Value:%@****",aStr); if (!aStr) { return YES; } @@ -29,29 +28,24 @@ + (BOOL)isBlankString:(NSString *)aStr { return NO; } //对比两个NSArray -+(NSDictionary *)ComNSArray:(NSArray *)arr1:(NSArray *)arr2 -{ ++ (NSDictionary *)ComNSArray:(NSArray *)arr1:(NSArray *)arr2 { NSDictionary *cmpres; NSArray *reduce = [arr1 filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"NOT (SELF in %@)", arr2]]; NSArray *incre = [arr2 filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"NOT (SELF in %@)", arr1]]; - if (reduce.count==0 && incre.count==0) - { - cmpres=@{@"chres":@"same",@"reduce":@"",@"incre":@""}; - } - else - { - cmpres=@{@"chres":@"different",@"reduce":reduce,@"incre":incre}; + if (reduce.count == 0 && incre.count == 0) { + cmpres = @{@"chres" : @"same", @"reduce" : @"", @"incre" : @""}; + } else { + cmpres = @{@"chres" : @"different", @"reduce" : reduce, @"incre" : incre}; } return cmpres; - } //判断NSDictionary是否存在空关键字 + (NSDictionary *)CheckDictEmpty:(NSDictionary *)checkDict { - NSDictionary * dechres; - NSArray * emptykeys; - + NSDictionary *dechres; + NSArray *emptykeys; + for (NSString *key in checkDict) { - //NSLog(@"PRO Value:%@-->%@",key,ckdict[key]); + // NSLog(@"PRO Value:%@-->%@",key,ckdict[key]); id value = checkDict[key]; NSString *waitForCheckString = nil; //添加对多重字典的支持 @@ -69,86 +63,100 @@ + (NSDictionary *)CheckDictEmpty:(NSDictionary *)checkDict { [self CheckDictEmpty:v]; } } - + if ([self isBlankString:waitForCheckString]) { emptykeys = [NSArray arrayWithObject:key]; } } - - if (emptykeys.count>0) { - dechres=@{@"chres":@"Failed",@"EmptyKeys":emptykeys}; + + if (emptykeys.count > 0) { + dechres = @{@"chres" : @"Failed", @"EmptyKeys" : emptykeys}; } else { - dechres=@{@"chres":@"Passed",@"EmptyKeys":@""}; + dechres = @{@"chres" : @"Passed", @"EmptyKeys" : @""}; } return dechres; } -//Vst事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)VstEventCheck:(NSDictionary *)vstevent -{ +// Vst事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)visitEventCheck:(NSDictionary *)vstevent { NSDictionary *vstchres; - //测试中发现测量协议字段过多,产品删除了b, p, ch,dt - //NSArray * vstprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"av",@"b",@"domain",@"pageName",@"r",@"ch",@"screenHeight",@"screenWidth",@"deviceBrand",@"deviceModel",@"deviceType",@"operatingSystem",@"operatingSystemVersion",@"ca",@"appVersion",@"appName",@"textValue",@"language",@"latitude",@"longitude",@"globalSequenceId",@"eventSequenceId",@"tz",@"utm",@"cb",@"iv",@"dt",@"ui",@"userId"]; -// NSArray * vstprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"av",@"domain",@"r",@"screenHeight",@"screenWidth",@"deviceBrand",@"deviceModel",@"deviceType",@"operatingSystem",@"operatingSystemVersion",@"ca",@"appVersion",@"appName",@"textValue",@"language",@"latitude",@"longitude",@"globalSequenceId",@"eventSequenceId",@"tz",@"utm",@"cb",@"iv",@"ui",@"userId"]; - - //SDK重构2.5.0,调整测量协议 2-18-08-09 - NSArray *vstprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"av",@"domain",@"screenHeight",@"screenWidth",@"deviceBrand",@"deviceModel",@"deviceType",@"operatingSystem",@"operatingSystemVersion",@"appVersion",@"appName",@"textValue",@"language",@"latitude",@"longitude",@"iv",@"ui",@"userId",@"globalSequenceId",@"eventSequenceId",@"fv"]; + NSArray *vstprome = @[ + @"userId", + @"sessionId", + @"eventType", + @"timestamp", + @"av", + @"domain", + @"screenHeight", + @"screenWidth", + @"deviceBrand", + @"deviceModel", + @"deviceType", + @"operatingSystem", + @"operatingSystemVersion", + @"appVersion", + @"appName", + @"textValue", + @"language", + @"latitude", + @"longitude", + @"iv", + @"ui", + @"userId", + @"globalSequenceId", + @"eventSequenceId", + @"fv" + ]; //对比测量协议结构 - if (vstevent.count>0) - { - NSArray * chevst=vstevent.allKeys; - vstchres=@{@"ProCheck":[self ComNSArray:vstprome :chevst],@"KeysCheck":[self CheckDictEmpty:vstevent]}; + if (vstevent.count > 0) { + NSArray *chevst = vstevent.allKeys; + vstchres = @{@"ProCheck" : [self ComNSArray:vstprome:chevst], @"KeysCheck" : [self CheckDictEmpty:vstevent]}; } return vstchres; } -//clck事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ClckEventCheck:(NSDictionary *)clckevent -{ +// clck事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)clickEventCheck:(NSDictionary *)clckevent { NSDictionary *clckchres; - // NSArray * clckprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"ppt",@"pctm",@"pageShowTimestamp",@"domain",@"pageName",@"r",@"timestamp",@"textValue",@"globalSequenceId",@"eventSequenceId",@"xpath",@"index",@"userId"]; - //SDK重构2.5.0,调整测量协议 2-18-08-09 - NSArray * clckprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"pageName",@"textValue",@"xpath",@"index",@"userId",@"globalSequenceId",@"eventSequenceId"]; + NSArray *clckprome = @[ + @"userId", @"sessionId", @"eventType", @"timestamp", @"domain", @"pageName", @"textValue", @"xpath", @"index", + @"userId", @"globalSequenceId", @"eventSequenceId" + ]; //对比测量协议结构 - if (clckevent.count>0) - { - NSArray * chevst=clckevent.allKeys; - clckchres=@{@"ProCheck":[self ComNSArray:clckprome :chevst],@"KeysCheck":[self CheckDictEmpty:clckevent]}; + if (clckevent.count > 0) { + NSArray *chevst = clckevent.allKeys; + clckchres = @{@"ProCheck" : [self ComNSArray:clckprome:chevst], @"KeysCheck" : [self CheckDictEmpty:clckevent]}; } return clckchres; } -//VIEW_CHANGE事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ChngEventCheck:(NSDictionary *)chngevent -{ +// VIEW_CHANGE事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)viewChangeEventCheck:(NSDictionary *)chngevent { NSDictionary *chngchres; - //NSArray * chngprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"ppt",@"pctm",@"pageShowTimestamp",@"domain",@"pageName",@"globalSequenceId",@"eventSequenceId",@"eventName",@"xpath",@"textValue",@"timestamp",@"userId"]; - //SDK重构2.5.0,调整测量协议 2-18-08-09 - NSArray * chngprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"pageName",@"eventName",@"xpath",@"textValue",@"timestamp",@"userId",@"globalSequenceId",@"eventSequenceId"]; + NSArray *chngprome = @[ + @"userId", @"sessionId", @"eventType", @"timestamp", @"domain", @"pageName", @"eventName", @"xpath", + @"textValue", @"timestamp", @"userId", @"globalSequenceId", @"eventSequenceId" + ]; //对比测量协议结构 - if (chngevent.count>0) - { - NSArray * chngvst=chngevent.allKeys; - chngchres=@{@"ProCheck":[self ComNSArray:chngprome :chngvst],@"KeysCheck":[self CheckDictEmpty:chngevent]}; + if (chngevent.count > 0) { + NSArray *chngvst = chngevent.allKeys; + chngchres = + @{@"ProCheck" : [self ComNSArray:chngprome:chngvst], @"KeysCheck" : [self CheckDictEmpty:chngevent]}; } return chngchres; } -//imp事件对比,测量协议字段完整且每个字段不为空 -+(NSDictionary *)ImpEventCheck:(NSDictionary *)impevent -{ +// imp事件对比,测量协议字段完整且每个字段不为空 ++ (NSDictionary *)ImpEventCheck:(NSDictionary *)impevent { NSDictionary *impchres; - //NSArray * impprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"pageName",@"globalSequenceId",@"eventSequenceId",@"ppt",@"pctm",@"pageShowTimestamp",@"timestamp",@"eventName",@"textValue",@"xpath",@"index",@"userId"]; - //修改测量协议,去掉gesid,esid两项,2018-05-30 - //NSArray * impprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"pageName",@"ppt",@"pctm",@"pageShowTimestamp",@"timestamp",@"eventName",@"textValue",@"xpath",@"index",@"userId"]; - //SDK重构2.5.0,调整测量协议 2018-08-09 - NSArray * impprome=@[@"userId",@"sessionId",@"eventType",@"timestamp",@"domain",@"pageName",@"timestamp",@"eventName",@"textValue",@"xpath",@"index",@"userId"]; + NSArray *impprome = @[ + @"userId", @"sessionId", @"eventType", @"timestamp", @"domain", @"pageName", @"timestamp", @"eventName", + @"textValue", @"xpath", @"index", @"userId" + ]; //对比测量协议结构 - if (impevent.count>0) - { - NSArray * impkeys=impevent.allKeys; - impchres=@{@"ProCheck":[self ComNSArray:impprome :impkeys],@"KeysCheck":[self CheckDictEmpty:impevent]}; + if (impevent.count > 0) { + NSArray *impkeys = impevent.allKeys; + impchres = @{@"ProCheck" : [self ComNSArray:impprome:impkeys], @"KeysCheck" : [self CheckDictEmpty:impevent]}; } return impchres; } @end - diff --git a/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.h b/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.h deleted file mode 100644 index 365e2d5d4..000000000 --- a/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// AppVarEventsTest.h -// GIOAutoTests -// -// Created by GrowingIO on 2018/6/11. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import - -@interface AppVarEventsTest : KIFTestCase - -@end diff --git a/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.m b/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.m deleted file mode 100644 index 98e3b7a13..000000000 --- a/Example/ExampleTests/ManualTrackTest/AppVarEventsTest.m +++ /dev/null @@ -1,507 +0,0 @@ -//// -//// AppVarEventsTest.m -//// GIOAutoTests -//// -//// Created by GrowingIO on 2018/6/11. -//// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -//// -// -//#import "AppVarEventsTest.h" -//#import "MockEventQueue.h" -//#import "ManualTrackHelper.h" -//#import "LogOperHelper.h" -// -//@implementation AppVarEventsTest -// -//-(void)test1AppVarNormal{ -// /** -// function:setAppVariable正常情况 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVar"]; -// [tester enterTextIntoCurrentFirstResponder:@"{\"cs2\":\"GIO\",\"cs3\":\"QA\"}"]; -// [[viewTester usingLabel:@"SetAppVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:apvarchr :@"attributes"]); -// XCTAssertEqualObjects(apvarchr[@"attributes"][@"cs2"], @"GIO"); -// XCTAssertEqualObjects(apvarchr[@"attributes"][@"cs3"], @"QA"); -// NSLog(@"AppVar事件,setAppVariable正常情况测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable正常情况测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test2AppVarNil{ -// /** -// function:setAppVariable,var为nil -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVar"]; -// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetAppVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// -// XCTAssertEqual(1, 1); -// NSLog(@"AppVar事件,setAppVariable,var为nil日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable,var为nil日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test3AppVarEmpty{ -// /** -// function:setAppVariable,var为Dict为空 -// 2019-1-7,优化支持传空对象:{} -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVar"]; -// [tester enterTextIntoCurrentFirstResponder:@"{}"]; -// [[viewTester usingLabel:@"SetAppVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// NSLog(@"AppVar事件,setAppVariable,var为Dict为空测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable,var为Dict为空测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -// -//// //将Log日志写入文件 -//// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetAppVar"] tap]; -//// //检测日志输出 -//// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -//// //恢复日志重定向 -//// [LogOperHelper redirectLogBack]; -//// if(chres) -//// { -//// -//// XCTAssertEqual(1, 1); -//// NSLog(@"AppVar事件,setAppVariable,var为Dict为空日志检测测试通过-----passed"); -//// } -//// else -//// { -//// NSLog(@"AppVar事件,setAppVariable,var为Dict为空日志检测测试失败---Failed"); -//// XCTAssertEqual(1,0); -//// } -//} -// -//-(void)test4AppVarStr{ -// /** -// function:setAppVariable:andStringValue设置变量 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs4"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"Addr BeiJing"]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:apvarchr :@"attributes"]); -// XCTAssertEqualObjects(apvarchr[@"attributes"][@"cs4"], @"Addr BeiJing"); -// NSLog(@"AppVar事件,setAppVariable:andStringValue设置变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue设置变量测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test2AppVarStrUpdate{ -// /** -// function:setAppVariable:andStringValue更新变量 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs4"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"Addr HeNan"]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:apvarchr :@"attributes"]); -// XCTAssertEqualObjects(apvarchr[@"attributes"][@"cs4"], @"Addr HeNan"); -// NSLog(@"AppVar事件,setAppVariable:andStringValue更新变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue更新变量测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test6AppVarStrKeyEmpty{ -// /** -// function:setAppVariable:andStringValue Key为空 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@""]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"Addr HeNan"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andStringValue Key为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue Key为空日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test7AppVarStrKeyNil{ -// /** -// function:setAppVariable:andStringValue Key为Nil -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"Addr HeNan"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andStringValue Key为nil日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue Key为nil日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test8AppVarStrValueNil{ -// /** -// function:setAppVariable:andStringValue Value为Nil,清除关键字,不发送数据 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs2"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// NSLog(@"AppVar事件:%@",apvarEventArray); -// if(apvarEventArray.count==0) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andStringValue Value为Nil,清除关键字,不发送数据测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue Value为Nil,清除关键字,不发送数据测试失败----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test9AppVarStrValueEmpty{ -// /** -// function:setAppVariable:andStringValue Value为空日志检测 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs2"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarSVal"]; -// [tester enterTextIntoCurrentFirstResponder:@""]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApSVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andStringValue Value为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andStringValue Value为空日志检测测试失败----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test10AppVarNumValue{ -// /** -// function:setAppVariable:andNumberValue设置变量 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs2"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"422"]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// //NSLog(@"*****AppVar事件:%@",apvarchr); -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:apvarchr :@"attributes"]); -// XCTAssertEqual([apvarchr[@"attributes"][@"cs2"] intValue], 422); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue设置变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue设置变量测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test11AppVarNumValueUpdate{ -// /** -// function:setAppVariable:andNumberValue更新变量 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs2"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"39.82"]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *apvarEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //NSLog(@"AppVar事件:%@",apvarEventArray); -// if (apvarEventArray.count>=1) -// { -// NSDictionary *apvarchr=[apvarEventArray objectAtIndex:apvarEventArray.count-1]; -// //NSLog(@"*****AppVar事件:%@",apvarchr); -// XCTAssertEqualObjects(apvarchr[@"eventType"], @"PAGE"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:apvarchr :@"attributes"]); -// NSString *floatchr=@"39.82"; -// XCTAssertEqual([apvarchr[@"attributes"][@"cs2"] floatValue], [floatchr floatValue]); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue更新变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue更新变量测试失败:%@",apvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test12AppVarNumValueKeyNil{ -// /** -// function:setAppVariable:andNumberValue Key为nil -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"39.82"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Key为nil日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Key为nil日志检测测试失败----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test13AppVarNumValueKeyEmpty{ -// /** -// function:setAppVariable:andNumberValue Key为空 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@""]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"39.82"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Key为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Key为空日志检测测试失败----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test14AppVarNumValueNumEmptyStr{ -// /** -// function:setAppVariable:andNumberValue Number为空 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs6"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@""]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Number为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Number为空日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test12AppVarNumValueNumStr{ -// /** -// function:setAppVariable:andNumberValue Number为字符串 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"AppVarKey"]; -// [tester enterTextIntoCurrentFirstResponder:@"cs6"]; -// [tester tapViewWithAccessibilityLabel:@"AppVarNVal"]; -// [tester enterTextIntoCurrentFirstResponder:@"GIO"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApNVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Number为字符串日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable:andNumberValue Number为字符串日志检测测试失败-----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -// -//-(void)test16AppVarDictOutRange{ -// /** -// function:setAppVariable字典为超过100个键值对 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"appvar请求"] tap]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetApOutR"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"AppVar事件,setAppVariable字典为超过100个键值对,日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"AppVar事件,setAppVariable字典为超过100个键值对,日志检测测试失败-----Failed"); -// XCTAssertEqual(1,0); -// } -//} -//@end diff --git a/Example/ExampleTests/ManualTrackTest/CS1ManualTrackTest.m b/Example/ExampleTests/ManualTrackTest/CS1ManualTrackTest.m index 9fc1c8413..916946ee8 100644 --- a/Example/ExampleTests/ManualTrackTest/CS1ManualTrackTest.m +++ b/Example/ExampleTests/ManualTrackTest/CS1ManualTrackTest.m @@ -182,13 +182,6 @@ - (void)test6NilCheck { function:UID为nil ***/ [MockEventQueue.sharedQueue cleanQueue]; - // [tester scrollViewWithAccessibilityIdentifier:@"MeasurementProtocolTableView" byFractionOfSizeHorizontal:0.0f - // vertical:-0.3f]; [tester waitForTimeInterval:1]; - // [[viewTester usingLabel:@"+ (void)setUserId:(NSString *)userId;"] tap]; - // //设置初值 - // [tester tapViewWithAccessibilityLabel:@"userIdTextField"]; - // [tester clearTextFromAndThenEnterTextIntoCurrentFirstResponder:@"NULL"]; - // [[viewTester usingLabel:@"CustomSet"] tap]; [Growing setLoginUserId:NULL]; [tester waitForTimeInterval:2]; NSArray *vstEventArray = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; @@ -274,18 +267,11 @@ - (void)test9CheckSessionChangeByChangeUserID { // 时间戳setUserId 方便触发事件获取session [Growing setLoginUserId:timeSp]; [tester waitForTimeInterval:2]; - - // NSArray *EventArrayOld = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; - // NSDictionary *cstmchr=[EventArrayOld objectAtIndex:EventArrayOld.count-1]; - // NSString *oldSession = cstmchr[@"sessionId"]; NSString *oldSession = [Growing getSessionId]; XCTAssertNotNil(oldSession); [Growing cleanLoginUserId]; [Growing setLoginUserId:@"lisi"]; - // NSArray *cstmEventArrayNew = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; - // NSDictionary *cstmchrNew=[cstmEventArrayNew objectAtIndex:cstmEventArrayNew.count-1]; - // NSString *newSession = cstmchrNew[@"sessionId"]; NSString *newSession = [Growing getSessionId]; XCTAssertNotNil(newSession); XCTAssertNotEqual(oldSession, newSession); @@ -298,9 +284,6 @@ - (void)test10CheckSessionChangeByChangeUserIDAndBG { NSString *timeSp = [NSString stringWithFormat:@"%lld", (long long)[datenow timeIntervalSince1970] * 1000LL]; // 时间戳setUserId 方便触发事件获取session [Growing setLoginUserId:timeSp]; - // NSArray *EventArrayOld = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; - // NSDictionary *cstmchr=[EventArrayOld objectAtIndex:EventArrayOld.count-1]; - // NSString *oldSession = cstmchr[@"sessionId"]; NSString *oldSession = [Growing getSessionId]; XCTAssertNotNil(oldSession); @@ -308,40 +291,12 @@ - (void)test10CheckSessionChangeByChangeUserIDAndBG { [self enterBackground]; [self enterForeground]; [Growing setLoginUserId:@"lisi"]; - // NSArray *EventArrayNew = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; - // NSDictionary *chrNew=[EventArrayNew objectAtIndex:EventArrayNew.count-1]; - // NSString *newSession = chrNew[@"sessionId"]; NSString *newSession = [Growing getSessionId]; XCTAssertNotNil(newSession); XCTAssertNotEqual(oldSession, newSession); NSLog(@"old:%@,new:%@", oldSession, newSession); } -//-(void) test11CheckSessionChangeByTime{ -// // userID 切换后台超过31秒 sessionid 变 -// [MockEventQueue.sharedQueue cleanQueue]; -// NSDate *datenow = [NSDate date]; -// NSString *timeSp = [NSString stringWithFormat:@"%lld", (long long)[datenow timeIntervalSince1970]]; -// // 时间戳setUserId 方便触发事件获取session -// [Growing setLoginUserId:timeSp]; -// NSArray *EventArrayOld = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; -// NSDictionary *chr=[EventArrayOld objectAtIndex:EventArrayOld.count-1]; -// NSString *oldSession = chr[@"sessionId"]; -//// NSString *oldSession = [Growing getSessionId]; -// XCTAssertNotNil(oldSession); -// [MockEventQueue.sharedQueue cleanQueue]; -// [self enterBackground]; -// [tester waitForTimeInterval:31]; -// [self enterForeground]; -// NSArray *EventArrayNew = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; -// NSDictionary *chrNew=[EventArrayNew objectAtIndex:EventArrayNew.count-1]; -// NSString *newSession = chrNew[@"sessionId"]; -//// NSString *newSession = [Growing getSessionId]; -// XCTAssertNotNil(newSession); -// XCTAssertNotEqual(oldSession, newSession); -// NSLog(@"old:%@,new:%@",oldSession,newSession); -//} - - (void)enterBackground { UIApplication *app = [UIApplication sharedApplication]; [app.delegate applicationWillResignActive:app]; diff --git a/Example/ExampleTests/ManualTrackTest/EvarEventsTest.h b/Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.h similarity index 75% rename from Example/ExampleTests/ManualTrackTest/EvarEventsTest.h rename to Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.h index f6bd8cfd1..ee254cb78 100644 --- a/Example/ExampleTests/ManualTrackTest/EvarEventsTest.h +++ b/Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.h @@ -8,6 +8,6 @@ #import -@interface EvarEventsTest : KIFTestCase +@interface ConversionVariablesEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ManualTrackTest/EvarEventsTest.m b/Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.m similarity index 62% rename from Example/ExampleTests/ManualTrackTest/EvarEventsTest.m rename to Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.m index d95baed72..8f3ce3cc9 100644 --- a/Example/ExampleTests/ManualTrackTest/EvarEventsTest.m +++ b/Example/ExampleTests/ManualTrackTest/ConversionVariablesEventsTest.m @@ -6,14 +6,14 @@ // Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. // -#import "EvarEventsTest.h" +#import "ConversionVariablesEventsTest.h" #import "GrowingTracker.h" #import "LogOperHelper.h" #import "ManualTrackHelper.h" #import "MockEventQueue.h" -@implementation EvarEventsTest +@implementation ConversionVariablesEventsTest - (void)setUp { //设置userid,确保cs1字段不空 @@ -25,11 +25,6 @@ - (void)test1SetEvarNormal { function:setEvar正常情况 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"Evalue"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"var1\":\"good\",\"var2\":\"excell\"}"]; - // [[viewTester usingLabel:@"SendEvar"] tap]; [Growing setConversionVariables:@{@"var1" : @"good", @"var2" : @"excell"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -57,10 +52,6 @@ - (void)test2SetEvarNil { function:setEvar Nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"Evalue"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendEvar"] tap]; @@ -84,11 +75,6 @@ - (void)test3SetEvarEmpty { 2019-1-7,优化支持传空对象:{} **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"Evalue"]; - // [tester enterTextIntoCurrentFirstResponder:@"{}"]; - // [[viewTester usingLabel:@"SendEvar"] tap]; [Growing setConversionVariables:@{}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -106,24 +92,6 @@ - (void)test3SetEvarEmpty { NSLog(@"EVar事件,setEvar正常情况测试失败:%@", evarEventArray); XCTAssertEqual(1, 0); } - - // //将Log日志写入文件 - // [LogOperHelper writeLogToFile]; - // [[viewTester usingLabel:@"SendEvar"] tap]; - // //检测日志输出 - // Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; - // //恢复日志重定向 - // [LogOperHelper redirectLogBack]; - // if(chres) - // { - // XCTAssertEqual(1,1); - // NSLog(@"EVar事件,setEvar空字典,日志提醒测试通过-----passed"); - // } - // else - // { - // NSLog(@"EVar事件,setEvar空字典,日志提醒测试失败!---Failed"); - // XCTAssertEqual(1,0); - // } } - (void)test4SetEvarKeyStr { @@ -131,13 +99,6 @@ - (void)test4SetEvarKeyStr { function:setEvarWithKey:andStringValue设置变量 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"ekey1"]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"Good"]; - // [[viewTester usingLabel:@"SendESVar"] tap]; [Growing setConversionVariables:@{@"ekey1" : @"Good"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -164,13 +125,6 @@ - (void)test2SetEvarKeyStrUpdate { function:setEvarWithKey:andStringValue更新变量 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"ekey1"]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"Better"]; - // [[viewTester usingLabel:@"SendESVar"] tap]; [Growing setConversionVariables:@{@"ekey1" : @"Better"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -197,12 +151,6 @@ - (void)test6SetEvarKeyEmpty { function:setEvarWithKey:andStringValue关键字为空,检测日志 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"Better"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendESVar"] tap]; @@ -225,12 +173,6 @@ - (void)test7SetEvarKeyNil { function:setEvarWithKey:andStringValue关键字为nil,检测日志 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"Better"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendESVar"] tap]; @@ -248,48 +190,11 @@ - (void)test7SetEvarKeyNil { } } -//-(void)test8SetEvarValNil{ -// /** -// function:setEvarWithKey:andStringValue 值为Nil -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"evar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"EvarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"ekey1"]; -//// [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SendESVar"] tap]; -//// [Growing setConversionVariables:@{@"ekey1":nil}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"EVar事件,setEvarWithKey:andStringValue值为Nil,日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"EVar事件,setEvarWithKey:andStringValue值为Nil,日志检测测试失败-----Failed"); -// XCTAssertEqual(1,0); -// } -//} - - (void)test9SetEvarValStrEmpty { /** function:setEvarWithKey:andStringValue Str值为空,不发送数据,日志检测 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"ekey1"]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendESVar"] tap]; @@ -312,13 +217,6 @@ - (void)test10SetEvarValNum { function:setEvarWithKey:andNumberValue设置变量 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"evkey1"]; - // [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"132"]; - // [[viewTester usingLabel:@"SendENVar"] tap]; [Growing setConversionVariables:@{@"evkey1" : @"132"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -345,13 +243,6 @@ - (void)test11SetEvarValNumUpdate { function:setEvarWithKey:andNumberValue更新变量 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"evkey1"]; - // [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"43.22"]; - // [[viewTester usingLabel:@"SendENVar"] tap]; [Growing setConversionVariables:@{@"evkey1" : @"43.22"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; @@ -379,12 +270,6 @@ - (void)test12SetEvarValNumKeyEmpty { function:setEvarWithKey:andNumberValue Key为空,日志检测 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"43.22"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendENVar"] tap]; @@ -402,48 +287,11 @@ - (void)test12SetEvarValNumKeyEmpty { } } -//-(void)test13SetEvarValNumKeyNil{ -// /** -// function:setEvarWithKey:andNumberValue Key为Nil -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"evar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"EvarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; -//// [tester enterTextIntoCurrentFirstResponder:@"123"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SendENVar"] tap]; -// [Growing setConversionVariables:@{NULL:@"43.22"}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"EVar事件,setEvarWithKey:andNumberValue Key为Nil,日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"EVar事件,setEvarWithKey:andNumberValue Key为Nil,日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} - - (void)test14SetEvarValNumValEmpty { /** function:setEvarWithKey:andNumberValue Value为空 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"enkey2"]; - // [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SendENVar"] tap]; @@ -460,49 +308,12 @@ - (void)test14SetEvarValNumValEmpty { XCTAssertEqual(1, 0); } } -//-(void)test12SetEvarValNumValNil{ -// /** -// function:setEvarWithKey:andNumberValue Value为Nil -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"evar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"EvarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"enkey2"]; -//// [tester tapViewWithAccessibilityLabel:@"EvarNumVal"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [Growing setConversionVariables:@{@"enkey2":NULL}]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SendENVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"EVar事件,setEvarWithKey:andNumberValue Value为Nil,日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"EVar事件,setEvarWithKey:andNumberValue Value为Nil,日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} - (void)test16SetEvarKeyStrChinese { /** function:setEvarWithKey:andStringValue关键字和值为中文 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"evar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"EvarKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"关键字"]; - // [tester tapViewWithAccessibilityLabel:@"EvarStrVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"北京"]; - // [[viewTester usingLabel:@"SendESVar"] tap]; [Growing setConversionVariables:@{@"关键字" : @"北京"}]; [tester waitForTimeInterval:3]; NSArray *evarEventArray = [MockEventQueue.sharedQueue eventsFor:@"CONVERSION_VARIABLES"]; diff --git a/Example/ExampleTests/ManualTrackTest/CstmEventsTest.h b/Example/ExampleTests/ManualTrackTest/CustomEventsTest.h similarity index 80% rename from Example/ExampleTests/ManualTrackTest/CstmEventsTest.h rename to Example/ExampleTests/ManualTrackTest/CustomEventsTest.h index 4a2d5bc3d..a6eb2f333 100644 --- a/Example/ExampleTests/ManualTrackTest/CstmEventsTest.h +++ b/Example/ExampleTests/ManualTrackTest/CustomEventsTest.h @@ -8,6 +8,6 @@ #import -@interface CstmEventsTest : KIFTestCase +@interface CustomEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ManualTrackTest/CstmEventsTest.m b/Example/ExampleTests/ManualTrackTest/CustomEventsTest.m similarity index 60% rename from Example/ExampleTests/ManualTrackTest/CstmEventsTest.m rename to Example/ExampleTests/ManualTrackTest/CustomEventsTest.m index 6933c8e62..f98060f93 100644 --- a/Example/ExampleTests/ManualTrackTest/CstmEventsTest.m +++ b/Example/ExampleTests/ManualTrackTest/CustomEventsTest.m @@ -9,14 +9,14 @@ // 1,根据bugs处理结果,优化测试用例 2018-06-26 // -#import "CstmEventsTest.h" +#import "CustomEventsTest.h" #import "GrowingTracker.h" #import "LogOperHelper.h" #import "ManualTrackHelper.h" #import "MockEventQueue.h" -@implementation CstmEventsTest +@implementation CustomEventsTest - (void)setUp { //设置userid,确保cs1字段不空 @@ -29,11 +29,6 @@ - (void)test1TrackNormal { function:EventId合法 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"GrowingIO2018"]; - // [[viewTester usingLabel:@"Track请求"] tap]; [Growing trackCustomEvent:@"GrowingIO2018"]; [tester waitForTimeInterval:2]; NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; @@ -43,7 +38,7 @@ - (void)test1TrackNormal { // NSLog(@"Cstm事件:%@",cstmchr); XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); XCTAssertEqualObjects(cstmchr[@"eventName"], @"GrowingIO2018"); - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -63,11 +58,6 @@ - (void)test2SpecialChar { function:EventId为特殊字符,正常发送数据 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO%#*/"]; - // [[viewTester usingLabel:@"Track请求"] tap]; [Growing trackCustomEvent:@"GIO%#*/"]; [tester waitForTimeInterval:2]; NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; @@ -76,7 +66,7 @@ - (void)test2SpecialChar { NSDictionary *cstmchr = [cstmEventArray objectAtIndex:cstmEventArray.count - 1]; XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); XCTAssertEqualObjects(cstmchr[@"eventName"], @"GIO%#*/"); - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -96,11 +86,6 @@ - (void)test3ChineseChar { function:EventId为中文,正常发送数据 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"企业增长"]; - // [[viewTester usingLabel:@"Track请求"] tap]; [Growing trackCustomEvent:@"企业增长"]; [tester waitForTimeInterval:2]; NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; @@ -109,7 +94,7 @@ - (void)test3ChineseChar { NSDictionary *cstmchr = [cstmEventArray objectAtIndex:cstmEventArray.count - 1]; XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); XCTAssertEqualObjects(cstmchr[@"eventName"], @"企业增长"); - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -152,11 +137,6 @@ - (void)test5EventIDNil { function:EventId为Nil,检测日志 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"Track请求"] tap]; @@ -179,10 +159,6 @@ - (void)test6EventIDEmpty { function:EventId为空,检测日志 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; @@ -201,59 +177,11 @@ - (void)test6EventIDEmpty { } } -//-(void)test8WithFloat{ -// /** -// function:WithNumber,浮点数 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"cstm请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"CstmEid"]; -//// [tester enterTextIntoCurrentFirstResponder:@"GIO"]; -//// [tester tapViewWithAccessibilityLabel:@"CstmTNum"]; -//// [tester enterTextIntoCurrentFirstResponder:@"21.35"]; -//// [[viewTester usingLabel:@"TrackNum"] tap]; -// -// // TO DO WithNumber 不用了测量协议确定 -// [Growing trackCustomEvent:@"GIO" withAttributes:@{@"num":@"21.35"}]; -// [tester waitForTimeInterval:2]; -// NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; -// //NSLog(@"Cstm事件:%@",cstmEventArray); -// if (cstmEventArray.count>=1) -// { -// NSDictionary *cstmchr=[cstmEventArray objectAtIndex:cstmEventArray.count-1]; -// XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); -// XCTAssertEqualObjects(cstmchr[@"eventName"], @"GIO"); -// NSString *cstmnum=[cstmchr objectForKey:@"num"]; -// NSString *chnum=@"21.35"; -// XCTAssertEqual([cstmnum floatValue],[chnum floatValue]); -// NSDictionary *chres=[ManualTrackHelper CstmEventCheck:cstmchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// //存在着与测量协议不一致的情况 -// NSArray *redu=chres[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(redu.count, 1); -// XCTAssertEqualObjects(chres[@"ProCheck"][@"reduce"][0],@"attributes"); -// NSLog(@"cstm事件,WithNumber,浮点数测试通过---passed!"); -// } -// else -// { -// NSLog(@"cstm事件,WithNumber,浮点数测试失败,cstm的n为:%@",cstmEventArray[0][@"num"]); -// XCTAssertEqual(1,0); -// } -//} - - (void)test9WithNumKeyNil { /** function:WithNumber,EventId为Nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - // [tester tapViewWithAccessibilityLabel:@"CstmTNum"]; - // [tester enterTextIntoCurrentFirstResponder:@"企业增长"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"TrackNum"] tap]; @@ -276,12 +204,6 @@ - (void)test10WithNumKeyEmpty { function:WithNumber,EventId为空 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"CstmTNum"]; - // [tester enterTextIntoCurrentFirstResponder:@"企业增长"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"TrackNum"] tap]; @@ -299,65 +221,11 @@ - (void)test10WithNumKeyEmpty { } } -//-(void)test12WithNumberVar{ -// /** -// function:WithNumber:andVariable正常情况 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"cstm请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"CstmEid"]; -//// [tester enterTextIntoCurrentFirstResponder:@"GIO"]; -//// [tester tapViewWithAccessibilityLabel:@"CstmTNum"]; -//// [tester enterTextIntoCurrentFirstResponder:@"123"]; -//// [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; -//// [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GIO\",\"title\":\"QA\"}"]; -// -//// [[viewTester usingLabel:@"TrackNumAV"] tap]; -// [Growing trackCustomEvent:@"GIO" withAttributes:@{@"num":@"123",@"name":@"GIO",@"title":@"QA"}]; -// -// [tester waitForTimeInterval:2]; -// NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; -// //NSLog(@"Cstm事件:%@",cstmEventArray); -// if (cstmEventArray.count>=1) -// { -// NSDictionary *cstmchr=[cstmEventArray objectAtIndex:cstmEventArray.count-1]; -// //判断关键字段 -// XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); -// XCTAssertEqualObjects(cstmchr[@"eventName"], @"GIO"); -// NSString *cstmnum=[cstmchr objectForKey:@"num"]; -// XCTAssertEqual([cstmnum intValue],123); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:cstmchr :@"attributes"]); -// XCTAssertEqualObjects(cstmchr[@"attributes"][@"name"], @"GIO"); -// XCTAssertEqualObjects(cstmchr[@"attributes"][@"title"], @"QA"); -// //判断测量协议 -// NSDictionary *chres=[ManualTrackHelper CstmEventCheck:cstmchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// //存在着与测量协议不一致的情况 -// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"],@"same"); -// NSLog(@"cstm事件,WithNumber:andVariable正常情况测试通过---passed!"); -// } -// else -// { -// NSLog(@"cstm事件,WithNumber:andVariable正常情况测试失败,cstm的n为:%@",cstmEventArray[0][@"num"]); -// XCTAssertEqual(1,0); -// } -//} - - (void)test18WithVariable { /** function:WithVariable,正常情况 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; - // [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GIO\",\"title\":\"QA\"}"]; - // - // [[viewTester usingLabel:@"TrackWV"] tap]; [Growing trackCustomEvent:@"GIO" withAttributes:@{@"name" : @"GIO", @"title" : @"QA"}]; [tester waitForTimeInterval:2]; @@ -372,7 +240,7 @@ - (void)test18WithVariable { XCTAssertEqualObjects(cstmchr[@"attributes"][@"name"], @"GIO"); XCTAssertEqualObjects(cstmchr[@"attributes"][@"title"], @"QA"); //判断测量协议 - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -391,14 +259,6 @@ - (void)test19WithVariableUpdate { function:WithVariable,更新数据 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; - // [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GrowingIO\",\"title\":\"RD\"}"]; - // - // [[viewTester usingLabel:@"TrackWV"] tap]; [Growing trackCustomEvent:@"GIO" withAttributes:@{@"name" : @"GrowingIO", @"title" : @"RD"}]; [tester waitForTimeInterval:2]; NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; @@ -412,7 +272,7 @@ - (void)test19WithVariableUpdate { XCTAssertEqualObjects(cstmchr[@"attributes"][@"name"], @"GrowingIO"); XCTAssertEqualObjects(cstmchr[@"attributes"][@"title"], @"RD"); //判断测量协议 - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -431,13 +291,6 @@ - (void)test20WithVariableNil { function:WithVariable,var为Nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; - // [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"TrackWV"] tap]; @@ -456,48 +309,11 @@ - (void)test20WithVariableNil { } } -//-(void)test21WithVariablePartError{ -// /** -// function:WithVariable,var部分合法 -// title:NULL,则向字典里添加一个nil -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"cstm请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"CstmEid"]; -// [tester enterTextIntoCurrentFirstResponder:@"GIO"]; -// [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; -// [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GrowingIO\",\"title\":\"\"}"]; -// -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"TrackWV"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"cstm事件,WithVariable,var部分合法测试通过---passed!"); -// } -// else -// { -// NSLog(@"cstm事件,WithVariable,var部分合法测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} - - (void)test22TrackChinese { /** function:EventId中文 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"北京"]; - // [[viewTester usingLabel:@"Track请求"] tap]; [Growing trackCustomEvent:@"北京"]; [tester waitForTimeInterval:2]; NSArray *cstmEventArray = [MockEventQueue.sharedQueue eventsFor:@"CUSTOM"]; @@ -508,7 +324,7 @@ - (void)test22TrackChinese { XCTAssertEqualObjects(cstmchr[@"eventType"], @"CUSTOM"); XCTAssertEqualObjects(cstmchr[@"eventName"], @"北京"); //判断测量协议 - NSDictionary *chres = [ManualTrackHelper CstmEventCheck:cstmchr]; + NSDictionary *chres = [ManualTrackHelper customEventCheck:cstmchr]; // NSLog(@"Check Result:%@",chres); XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); //存在着与测量协议不一致的情况 @@ -528,13 +344,6 @@ - (void)test23WithVariableEventidNil { function:WithVariable,EventId为nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - // [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GrowingIO\"}"]; - //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"TrackWV"] tap]; @@ -557,13 +366,6 @@ - (void)test24WithVariableEventidEmpty { function:WithVariable,EventId为空 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"cstm请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"CstmEid"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"CstmAVar"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"name\":\"GrowingIO\"}"]; - //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"TrackWV"] tap]; diff --git a/Example/ExampleTests/ManualTrackTest/PPLEventsTest.h b/Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.h similarity index 75% rename from Example/ExampleTests/ManualTrackTest/PPLEventsTest.h rename to Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.h index 74d9dbd45..c07e127e0 100644 --- a/Example/ExampleTests/ManualTrackTest/PPLEventsTest.h +++ b/Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.h @@ -8,6 +8,6 @@ #import -@interface PPLEventsTest : KIFTestCase +@interface LoginUserAttributerEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ManualTrackTest/PPLEventsTest.m b/Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.m similarity index 76% rename from Example/ExampleTests/ManualTrackTest/PPLEventsTest.m rename to Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.m index 4ca82b29e..be0bac9ec 100644 --- a/Example/ExampleTests/ManualTrackTest/PPLEventsTest.m +++ b/Example/ExampleTests/ManualTrackTest/LoginUserAttributerEventsTest.m @@ -6,14 +6,14 @@ // Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. // function:ppl事件相关测试用例 -#import "PPLEventsTest.h" +#import "LoginUserAttributerEventsTest.h" #import "GrowingTracker.h" #import "LogOperHelper.h" #import "ManualTrackHelper.h" #import "MockEventQueue.h" -@implementation PPLEventsTest +@implementation LoginUserAttributerEventsTest //-(void)tearDown{ // [[viewTester usingLabel:@"协议/接口"] tap]; @@ -50,11 +50,6 @@ - (void)test2PplNil { function:setPeopleVariable为nil,日志检测 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PVariable"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SetPV"] tap]; @@ -94,23 +89,6 @@ - (void)test3PplEmpty { NSLog(@"ppl事件,setPeopleVariable为空测试失败:%@", pplEventArray); XCTAssertEqual(1, 0); } - // //将Log日志写入文件 - // [LogOperHelper writeLogToFile]; - // [[viewTester usingLabel:@"SetPV"] tap]; - // //检测日志输出 - // Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; - // //恢复日志重定向 - // [LogOperHelper redirectLogBack]; - // if(chres) - // { - // XCTAssertEqual(1,1); - // NSLog(@"ppl事件,setPeopleVariable为空,日志检测测试通过-----passed"); - // } - // else - // { - // NSLog(@"ppl事件,setPeopleVariable为空,日志检测测试失败---Failed"); - // XCTAssertEqual(1,0); - // } } - (void)test4SpvAndStr { @@ -118,15 +96,7 @@ - (void)test4SpvAndStr { function:setPeopleVariableWithKey:andStringValue,发送正常数据 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"name"]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"GrowingIO"]; [Growing setLoginUserAttributes:@{@"name" : @"GrowingIO"}]; - // [[viewTester usingLabel:@"SetPVS"] tap]; - [tester waitForTimeInterval:2]; NSArray *pplEventArray = [MockEventQueue.sharedQueue eventsFor:@"LOGIN_USER_ATTRIBUTES"]; // NSLog(@"PPL事件:%@",pplEventArray); @@ -151,13 +121,6 @@ - (void)test5SpvAndStrUpdate { function:setPeopleVariableWithKey:andStringValue,更新数据 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"name"]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; - // [[viewTester usingLabel:@"SetPVS"] tap]; [Growing setLoginUserAttributes:@{@"name" : @"GIO"}]; [tester waitForTimeInterval:2]; NSArray *pplEventArray = [MockEventQueue.sharedQueue eventsFor:@"LOGIN_USER_ATTRIBUTES"]; @@ -183,12 +146,6 @@ - (void)test6SpvAndStrKeyError { function:setPeopleVariableWithKey:andStringValue,Key为空 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; [Growing setLoginUserAttributes:@{@"" : @"GIO"}]; @@ -211,12 +168,6 @@ - (void)test7SpvAndStrKeyNil { function:setPeopleVariableWithKey:andStringValue,Key为Nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"GIO"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SetPVS"] tap]; @@ -240,12 +191,6 @@ - (void)test8SpvAndStrValueNil { function:setPeopleVariableWithKey:andStringValue,Value为Nil **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"name"]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"NULL"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SetPVS"] tap]; @@ -269,12 +214,6 @@ - (void)test9SpvAndStrValueEmpty { function:setPeopleVariableWithKey:andStringValue,Value为Empty **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"name"]; - // [tester tapViewWithAccessibilityLabel:@"PplSVal"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SetPVS"] tap]; @@ -323,13 +262,6 @@ - (void)test11SpvAndNumUpdate { function:setPeopleVariableWithKey:andNumberValue更新为浮点数 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@"score"]; - // [tester tapViewWithAccessibilityLabel:@"PplNVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"23.62"]; - // [[viewTester usingLabel:@"SetPVN"] tap]; [Growing setLoginUserAttributes:@{@"score" : @"23.62"}]; [tester waitForTimeInterval:2]; NSArray *pplEventArray = [MockEventQueue.sharedQueue eventsFor:@"LOGIN_USER_ATTRIBUTES"]; @@ -357,12 +289,6 @@ - (void)test13SpvAndNumKeyError { function:setPeopleVariableWithKey:andNumberValue Key为空不发送事件 **/ [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"协议/接口"] tap]; - // [[viewTester usingLabel:@"ppl请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PplKey"]; - // [tester enterTextIntoCurrentFirstResponder:@""]; - // [tester tapViewWithAccessibilityLabel:@"PplNVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"42"]; //将Log日志写入文件 [LogOperHelper writeLogToFile]; // [[viewTester usingLabel:@"SetPVN"] tap]; diff --git a/Example/ExampleTests/ManualTrackTest/PvarEventsTest.h b/Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.h similarity index 77% rename from Example/ExampleTests/ManualTrackTest/PvarEventsTest.h rename to Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.h index 3bb2bfe5c..e4d37efb4 100644 --- a/Example/ExampleTests/ManualTrackTest/PvarEventsTest.h +++ b/Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.h @@ -8,6 +8,6 @@ #import -@interface PvarEventsTest : KIFTestCase +@interface PageAttributesEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.m b/Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.m new file mode 100644 index 000000000..70f13fbd2 --- /dev/null +++ b/Example/ExampleTests/ManualTrackTest/PageAttributesEventsTest.m @@ -0,0 +1,40 @@ +// +// PvarEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/6/11. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// function:Pvar事件测试用例集 + +#import "PageAttributesEventsTest.h" + +#import + +#import "LogOperHelper.h" +#import "ManualTrackHelper.h" +#import "MockEventQueue.h" + +@implementation PageAttributesEventsTest + +- (void)setUp { +} + +- (void)test1PvarNormal { + /** + function:setPageVariable正常情况 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"协议/接口"] tap]; + [[viewTester usingLabel:@"pvar请求"] tap]; + [tester waitForTimeInterval:2]; + NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; + if (pvarEventArray.count >= 1) { + NSDictionary *pvarchr = [pvarEventArray objectAtIndex:pvarEventArray.count - 1]; + XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); + NSLog(@"pvar事件, 测试通过-----passed"); + } else { + NSLog(@"pvar事件, 测试失败:%@", pvarEventArray); + XCTAssertEqual(1, 0); + } +} +@end diff --git a/Example/ExampleTests/ManualTrackTest/PvarEventsTest.m b/Example/ExampleTests/ManualTrackTest/PvarEventsTest.m deleted file mode 100644 index 0f64c0dba..000000000 --- a/Example/ExampleTests/ManualTrackTest/PvarEventsTest.m +++ /dev/null @@ -1,496 +0,0 @@ -// -// PvarEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/6/11. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// function:Pvar事件测试用例集 - -#import "PvarEventsTest.h" - -#import - -#import "LogOperHelper.h" -#import "ManualTrackHelper.h" -#import "MockEventQueue.h" - -@implementation PvarEventsTest - -- (void)setUp { -} - -- (void)test1PvarNormal { - /** - function:setPageVariable正常情况 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"协议/接口"] tap]; - [[viewTester usingLabel:@"pvar请求"] tap]; - // [tester tapViewWithAccessibilityLabel:@"PVarVal"]; - // [tester enterTextIntoCurrentFirstResponder:@"{\"page1\":\"test\",\"ptvar\":\"flag1\"}"]; - // [[viewTester usingLabel:@"SetPgVar"] tap]; - // [Growing setPageAttributes:@{@"page1":@"test",@"ptvar":@"flag1"}]; - [tester waitForTimeInterval:2]; - NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; - // NSLog(@"PVar事件:%@",pvarEventArray); - if (pvarEventArray.count >= 1) { - NSDictionary *pvarchr = [pvarEventArray objectAtIndex:pvarEventArray.count - 1]; - XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); - // XCTAssertTrue([ManualTrackHelper CheckContainsKey:pvarchr :@"attributes"]); - // XCTAssertEqualObjects(pvarchr[@"attributes"][@"page1"], @"test"); - // XCTAssertEqualObjects(pvarchr[@"attributes"][@"ptvar"], @"flag1"); - // NSDictionary *chres=[ManualTrackHelper PvarEventCheck:pvarchr]; - // //NSLog(@"Check Result:%@",chres); - // XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); - // XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); - NSLog(@"pvar事件, 测试通过-----passed"); - } else { - NSLog(@"pvar事件, 测试失败:%@", pvarEventArray); - XCTAssertEqual(1, 0); - } -} - -//-(void)test2PvarNil{ -// /** -// function:setPageVariable,pvar为nil,为清除pvar事件 -// 2019-1-7 优化测试用例 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarVal"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [[viewTester usingLabel:@"SetPgVar"] tap]; -//// [Growing setPageAttributes:NULL]; -// [tester waitForTimeInterval:2]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// -//// //将Log日志写入文件 -//// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVar"] tap]; -//// //检测日志输出 -//// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -//// //恢复日志重定向 -//// [LogOperHelper redirectLogBack]; -// if(pvarEventArray.count==0) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariable,pvar为nil,日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariable,pvar为nil,日志检测测试失败-----Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test3PvarEmpty{ -// /** -// function:setPageVariable,pvar为空 -// 2019-1-7,优化支持传空对象:{},为清除pvar事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarVal"]; -//// [tester enterTextIntoCurrentFirstResponder:@"{}"]; -//// -//// [[viewTester usingLabel:@"SetPgVar"] tap]; -//// [Growing setPageAttributes:@{}]; -// -// [tester waitForTimeInterval:2]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// //NSLog(@"PVar事件:%@",pvarEventArray); -// if (pvarEventArray.count==0) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariable,pvar为空测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariable,pvar为空测试失败:%@",pvarEventArray); -// XCTAssertEqual(1,0); -// } -// -// -//// //将Log日志写入文件 -//// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVar"] tap]; -//// //检测日志输出 -//// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -//// //恢复日志重定向 -//// [LogOperHelper redirectLogBack]; -//// if(chres) -//// { -//// XCTAssertEqual(1,1); -//// NSLog(@"pvar事件,setPageVariable,pvar为空,日志检测测试通过-----passed"); -//// } -//// else -//// { -//// NSLog(@"pvar事件,setPageVariable,pvar为空,日志检测测试失败-----Failed"); -//// XCTAssertEqual(1,0); -//// } -// -//} -// -// -//-(void)test4PvarKeyStr{ -// /** -// function:setPageVariableWithKey:andStringValue添加变量 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pvalue"]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{@"pvar1":@"pvalue"}]; -// [tester waitForTimeInterval:3]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// //NSLog(@"PVar事件:%@",pvarEventArray); -// if (pvarEventArray.count>=1) -// { -// NSDictionary *pvarchr=[pvarEventArray objectAtIndex:pvarEventArray.count-1]; -// XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:pvarchr :@"attributes"]); -// XCTAssertEqualObjects(pvarchr[@"attributes"][@"pvar1"], @"pvalue"); -// NSDictionary *chres=[ManualTrackHelper PvarEventCheck:pvarchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue添加变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue添加变量测试失败:%@",pvarEventArray); -// XCTAssertEqual(1,0); -// } -//} - -//-(void)test2PvarKeyStrUpdate{ -// /** -// function:setPageVariableWithKey:andStringValue更新变量 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pupdate"]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{@"pvar1":@"pupdate"}]; -// [tester waitForTimeInterval:3]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// //NSLog(@"PVar事件:%@",pvarEventArray); -// if (pvarEventArray.count>=1) -// { -// NSDictionary *pvarchr=[pvarEventArray objectAtIndex:pvarEventArray.count-1]; -// XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:pvarchr :@"attributes"]); -// XCTAssertEqualObjects(pvarchr[@"attributes"][@"pvar1"], @"pupdate"); -// NSDictionary *chres=[ManualTrackHelper PvarEventCheck:pvarchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue更新变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue更新变量测试失败:%@",pvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -// -//-(void)test6PvarKeyStrKeyEmpty{ -// /** -// function:setPageVariableWithKey:andStringValue key为空 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@""]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pupdate"]; -// -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{@"":@"pupdate"}]; -// -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue key为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue key为空日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test7PvarKeyStrKeyNil{ -// /** -// function:setPageVariableWithKey:andStringValue key为nil -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pupdate"]; -// -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{[NSNull null]:@"pupdate"}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue key为nil日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue key为nil日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test8PvarKeyStrValEmpty{ -// /** -// function:setPageVariableWithKey:andStringValue Value为空 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@""]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{@"pvar1":@""}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue Value为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue Value为空日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -// -//-(void)test9PvarKeyStrValNil{ -// /** -// function:setPageVariableWithKey:andStringValue Value为Nil清除变量 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarSv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [[viewTester usingLabel:@"SetPgVS"] tap]; -//// [Growing setPageAttributes:@{@"pvar1":[NSNull NULL]}]; -// [tester waitForTimeInterval:3]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// //NSLog(@"PVar事件:%@",pvarEventArray); -// if(pvarEventArray.count==0) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue Value为Nil清除变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andStringValue Value为Nil清除变量测试失败:%@",pvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -////-(void)test10PvarKeyNumVal{ -//// /** -//// function:setPageVariableWithKey:andNumValue 添加变量 -//// **/ -//// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pnvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarNv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"342"]; -//// [[viewTester usingLabel:@"SetPgVN"] tap]; -//// [tester waitForTimeInterval:3]; -//// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -//// //NSLog(@"PVar事件:%@",pvarEventArray); -//// if (pvarEventArray.count>=1) -//// { -//// NSDictionary *pvarchr=[pvarEventArray objectAtIndex:pvarEventArray.count-1]; -//// XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); -//// XCTAssertTrue([ManualTrackHelper CheckContainsKey:pvarchr :@"attributes"]); -//// XCTAssertEqual([pvarchr[@"attributes"][@"pnvar1"] intValue],342); -//// NSDictionary *chres=[ManualTrackHelper PvarEventCheck:pvarchr]; -//// //NSLog(@"Check Result:%@",chres); -//// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -//// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); -//// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue 添加变量测试通过-----passed"); -//// } -//// else -//// { -//// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue 添加变量测试失败:%@",pvarEventArray); -//// XCTAssertEqual(1,0); -//// } -////} -// -//-(void)test11PvarKeyNumValUpdate{ -// /** -// function:setPageVariableWithKey:andNumValue 更新变量 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pnvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarNv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"78.27"]; -//// [[viewTester usingLabel:@"SetPgVN"] tap]; -//// [Growing setPageAttributes:@{@"pnvar1":@"78.27"}]; -// [tester waitForTimeInterval:3]; -// NSArray *pvarEventArray = [MockEventQueue.sharedQueue eventsFor:@"pvar"]; -// //NSLog(@"PVar事件:%@",pvarEventArray); -// if (pvarEventArray.count>=1) -// { -// NSDictionary *pvarchr=[pvarEventArray objectAtIndex:pvarEventArray.count-1]; -// XCTAssertEqualObjects(pvarchr[@"eventType"], @"pvar"); -// XCTAssertTrue([ManualTrackHelper CheckContainsKey:pvarchr :@"attributes"]); -// NSString *fnum=@"78.27"; -// XCTAssertEqual([pvarchr[@"attributes"][@"pnvar1"] floatValue],[fnum floatValue]); -// NSDictionary *chres=[ManualTrackHelper PvarEventCheck:pvarchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue 更新变量测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue 更新变量测试失败:%@",pvarEventArray); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test12PvarKeyNumValKeyNil{ -// /** -// function:setPageVariableWithKey:andNumValue Key为nil日志检测 -// **/ -//// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarNv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"78.27"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVN"] tap]; -//// [Growing setPageAttributes:@{[NSNull null]:@"78.27"}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue Key为nil日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue Key为nil日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test13PvarKeyNumValKeyEmpty{ -// /** -// function:setPageVariableWithKey:andNumValue Key为空日志检测 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@""]; -//// [tester tapViewWithAccessibilityLabel:@"PVarNv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"78.27"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVN"] tap]; -//// [Growing setPageAttributes:@{@"":@"78.27"}]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue Key为空日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue Key为空日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -// -//-(void)test14PvarKeyNumValValueStr{ -// /** -// function:setPageVariableWithKey:andNumValue value为字符串日志检测 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -//// [[viewTester usingLabel:@"协议/接口"] tap]; -//// [[viewTester usingLabel:@"pvar请求"] tap]; -//// [tester tapViewWithAccessibilityLabel:@"PVarKey"]; -//// [tester enterTextIntoCurrentFirstResponder:@"pnvar1"]; -//// [tester tapViewWithAccessibilityLabel:@"PVarNv"]; -//// [tester enterTextIntoCurrentFirstResponder:@"GIO Test"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -//// [[viewTester usingLabel:@"SetPgVN"] tap]; -//// [Growing setPageAttributes:@{@"pnvar1":@"GIO Test"}]; -// -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue value为字符串日志检测测试通过-----passed"); -// } -// else -// { -// NSLog(@"pvar事件,setPageVariableWithKey:andNumValue value为字符串日志检测测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} -@end diff --git a/Example/ExampleTests/ManualTrackTest/VstrEventsTest.h b/Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.h similarity index 76% rename from Example/ExampleTests/ManualTrackTest/VstrEventsTest.h rename to Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.h index 31647fce4..13ccb95b2 100644 --- a/Example/ExampleTests/ManualTrackTest/VstrEventsTest.h +++ b/Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.h @@ -8,6 +8,6 @@ #import -@interface VstrEventsTest : KIFTestCase +@interface VisitorAttributesEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.m b/Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.m new file mode 100644 index 000000000..69c596f8c --- /dev/null +++ b/Example/ExampleTests/ManualTrackTest/VisitorAttributesEventsTest.m @@ -0,0 +1,50 @@ +// +// VstrEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/7/12. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// Function:vstr事件的测试 +// + +#import "VisitorAttributesEventsTest.h" + +#import "GrowingTracker.h" +#import "LogOperHelper.h" +#import "ManualTrackHelper.h" +#import "MockEventQueue.h" + +@implementation VisitorAttributesEventsTest + +- (void)setUp { + //设置userid,确保cs1字段不空 + [Growing setLoginUserId:@"test"]; +} + +- (void)test1VstrNormal { + /** + function:vstr正常情况 + **/ + [tester waitForTimeInterval:1]; + [MockEventQueue.sharedQueue cleanQueue]; + [Growing setVisitorAttributes:@{@"var1" : @"good", @"var2" : @"excell"}]; + NSArray *vstrEventArray = [MockEventQueue.sharedQueue eventsFor:@"VISITOR_ATTRIBUTES"]; + NSLog(@"Vstr事件:%@", vstrEventArray); + if (vstrEventArray.count >= 1) { + NSDictionary *epvarchr = [vstrEventArray objectAtIndex:vstrEventArray.count - 1]; + XCTAssertEqualObjects(epvarchr[@"eventType"], @"VISITOR_ATTRIBUTES"); + XCTAssertTrue([ManualTrackHelper CheckContainsKey:epvarchr:@"attributes"]); + XCTAssertEqualObjects(epvarchr[@"attributes"][@"var1"], @"good"); + XCTAssertEqualObjects(epvarchr[@"attributes"][@"var2"], @"excell"); + + NSDictionary *chres = [ManualTrackHelper visitorEventCheck:epvarchr]; + XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); + XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); + NSLog(@"EVar事件,vstr正常情况测试通过-----passed"); + } else { + NSLog(@"EVar事件,vstr正常情况测试失败:%@", vstrEventArray); + XCTAssertEqual(1, 0); + } +} + +@end diff --git a/Example/ExampleTests/ManualTrackTest/VstrEventsTest.m b/Example/ExampleTests/ManualTrackTest/VstrEventsTest.m deleted file mode 100644 index 83696a65c..000000000 --- a/Example/ExampleTests/ManualTrackTest/VstrEventsTest.m +++ /dev/null @@ -1,184 +0,0 @@ -// -// VstrEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/7/12. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// Function:vstr事件的测试 -// - -#import "VstrEventsTest.h" - -#import "GrowingTracker.h" -#import "LogOperHelper.h" -#import "ManualTrackHelper.h" -#import "MockEventQueue.h" - -@implementation VstrEventsTest - -- (void)setUp { - //设置userid,确保cs1字段不空 - [Growing setLoginUserId:@"test"]; -} - -- (void)test1VstrNormal { - /** - function:vstr正常情况 - **/ - [tester waitForTimeInterval:1]; - [MockEventQueue.sharedQueue cleanQueue]; - [Growing setVisitorAttributes:@{@"var1" : @"good", @"var2" : @"excell"}]; - NSArray *vstrEventArray = [MockEventQueue.sharedQueue eventsFor:@"VISITOR_ATTRIBUTES"]; - NSLog(@"Vstr事件:%@", vstrEventArray); - if (vstrEventArray.count >= 1) { - NSDictionary *epvarchr = [vstrEventArray objectAtIndex:vstrEventArray.count - 1]; - XCTAssertEqualObjects(epvarchr[@"eventType"], @"VISITOR_ATTRIBUTES"); - XCTAssertTrue([ManualTrackHelper CheckContainsKey:epvarchr:@"attributes"]); - XCTAssertEqualObjects(epvarchr[@"attributes"][@"var1"], @"good"); - XCTAssertEqualObjects(epvarchr[@"attributes"][@"var2"], @"excell"); - - NSDictionary *chres = [ManualTrackHelper VstrEventCheck:epvarchr]; - // NSLog(@"Check Result:%@",chres); - XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); - XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); - NSLog(@"EVar事件,vstr正常情况测试通过-----passed"); - } else { - NSLog(@"EVar事件,vstr正常情况测试失败:%@", vstrEventArray); - XCTAssertEqual(1, 0); - } -} - -//-(void)test2VstrNil{ -// /** -// function:vstr为Nil -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [tester scrollViewWithAccessibilityLabel:@"imp请求" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"vstr请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"SetVstr"]; -// [tester enterTextIntoCurrentFirstResponder:@"NULL"]; -// [[viewTester usingLabel:@"SetVVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *vstrEventArray = [MockEventQueue eventsFor:@"VISITOR_ATTRIBUTES"]; -// //NSLog(@"Vstr事件:%@",vstrEventArray); -// if (vstrEventArray.count==0) -// { -// XCTAssertEqual(1,1); -// NSLog(@"EVar事件,vstr为Nil测试成功---Passed"); -// } -// else -// { -// NSLog(@"EVar事件,vstr为Nil测试失败---Failed"); -// XCTAssertEqual(1,0); -// } -//} - -//-(void)test3VstrEmpty{ -// /** -// function:vstr为空 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [tester scrollViewWithAccessibilityLabel:@"imp请求" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"vstr请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"SetVstr"]; -// [tester enterTextIntoCurrentFirstResponder:@"{}"]; -// [[viewTester usingLabel:@"SetVVar"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *vstrEventArray = [MockEventQueue eventsFor:@"VISITOR_ATTRIBUTES"]; -// //NSLog(@"Vstr事件:%@",vstrEventArray); -// if (vstrEventArray.count>=1) -// { -// NSDictionary *epvarchr=[vstrEventArray objectAtIndex:vstrEventArray.count-1]; -// XCTAssertEqualObjects(epvarchr[@"eventType"], @"VISITOR_ATTRIBUTES"); -// NSDictionary *chres=[ManualTrackHelper VstrEventCheck:epvarchr]; -// //NSLog(@"Check Result:%@",chres); -// XCTAssertEqualObjects(chres[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(chres[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"EVar事件,vstr正常情况测试通过-----passed"); -// } -// else -// { -// NSLog(@"EVar事件,vstr正常情况测试失败:%@",vstrEventArray); -// XCTAssertEqual(1,0); -// } -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetVVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"Vstr事件,vstr为空,日志提醒测试通过-----passed"); -// } -// else -// { -// NSLog(@"Vstr事件,vstr为空,日志提醒,日志提醒测试失败!---Failed"); -// XCTAssertEqual(1,0); -// } -//} - -//-(void)test4VstrPartRight{ -// /** -// function:vstr Dict部分正确 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [tester scrollViewWithAccessibilityLabel:@"imp请求" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"vstr请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"SetVstr"]; -// [tester enterTextIntoCurrentFirstResponder:@"{\"Name\":\"SXF\",\"\":\"QA\"}"]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetVVar"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getFlagErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"Vstr事件,Dict部分正确,日志提醒测试通过-----passed"); -// } -// else -// { -// NSLog(@"Vstr事件,Dict部分正确,日志提醒,日志提醒测试失败!---Failed"); -// XCTAssertEqual(1,0); -// } -//} - -//-(void)test2VstrLargeDic{ -// /** -// function:vstr Dict为超过100个键值对 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [tester scrollViewWithAccessibilityLabel:@"imp请求" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"vstr请求"] tap]; -// //将Log日志写入文件 -// [LogOperHelper writeLogToFile]; -// [[viewTester usingLabel:@"SetVVarOR"] tap]; -// //检测日志输出 -// Boolean chres=[LogOperHelper CheckLogOutput:[LogOperHelper getValueErrNsLog]]; -// //恢复日志重定向 -// [LogOperHelper redirectLogBack]; -// if(chres) -// { -// XCTAssertEqual(1,1); -// NSLog(@"Vstr事件,Dict为超过100个键值对,日志提醒测试通过-----passed"); -// } -// else -// { -// NSLog(@"Vstr事件,Dict为超过100个键值对,日志提醒测试失败!---Failed"); -// XCTAssertEqual(1,0); -// } -//} -@end diff --git a/Example/ExampleTests/SDK Method Test/A1TrackAPIMainThreadTest.m b/Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m similarity index 100% rename from Example/ExampleTests/SDK Method Test/A1TrackAPIMainThreadTest.m rename to Example/ExampleTests/MethodTest/A1TrackAPIMainThreadTest.m diff --git a/Example/ExampleTests/SDK Method Test/DailyDataLimit.h b/Example/ExampleTests/MethodTest/DailyDataLimit.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/DailyDataLimit.h rename to Example/ExampleTests/MethodTest/DailyDataLimit.h diff --git a/Example/ExampleTests/MethodTest/DailyDataLimit.m b/Example/ExampleTests/MethodTest/DailyDataLimit.m new file mode 100644 index 000000000..0cd7b3d40 --- /dev/null +++ b/Example/ExampleTests/MethodTest/DailyDataLimit.m @@ -0,0 +1,30 @@ +// +// DailyDataLimit.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/6/19. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "DailyDataLimit.h" +#import "MockEventQueue.h" +#import "GrowingTracker.h" + +@implementation DailyDataLimit + +-(void)test1GetDailyDataLimit{ + /** + function:获取蜂窝当天数据限额 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + NSLog(@"获取蜂窝数据,测试通过---passed"); +} + +-(void) test2SetDailyDataLimit{ + /** + function:设置蜂窝当天数据限额 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + +} +@end diff --git a/Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.h b/Example/ExampleTests/MethodTest/FlushIntervalAPITest.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.h rename to Example/ExampleTests/MethodTest/FlushIntervalAPITest.h diff --git a/Example/ExampleTests/MethodTest/FlushIntervalAPITest.m b/Example/ExampleTests/MethodTest/FlushIntervalAPITest.m new file mode 100644 index 000000000..90fe18440 --- /dev/null +++ b/Example/ExampleTests/MethodTest/FlushIntervalAPITest.m @@ -0,0 +1,22 @@ +// +// FlushIntervalAPITest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/6/19. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "FlushIntervalAPITest.h" +#import "MockEventQueue.h" +#import "GrowingTracker.h" + +@implementation FlushIntervalAPITest + +-(void)test1GetFlushInterVal{ + +} + +-(void)test2SetFlushInterVal{ + +} +@end diff --git a/Example/ExampleTests/SDK Method Test/GDPRTest.h b/Example/ExampleTests/MethodTest/GDPRTest.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/GDPRTest.h rename to Example/ExampleTests/MethodTest/GDPRTest.h diff --git a/Example/ExampleTests/SDK Method Test/GDPRTest.m b/Example/ExampleTests/MethodTest/GDPRTest.m similarity index 78% rename from Example/ExampleTests/SDK Method Test/GDPRTest.m rename to Example/ExampleTests/MethodTest/GDPRTest.m index c3d989966..4df3f68f5 100644 --- a/Example/ExampleTests/SDK Method Test/GDPRTest.m +++ b/Example/ExampleTests/MethodTest/GDPRTest.m @@ -17,10 +17,7 @@ -(void) test1DisableDataCollect{ function:设置GDPR , 不采集数据 **/ [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"+ GDPR(数据保护)"] tap]; -// [[viewTester usingLabel:@"GDPR生效"] tap]; - [Growing setDataCollectionEnabled:NO]; + [Growing setDataTrackEnabled:NO]; [MockEventQueue.sharedQueue cleanQueue]; [tester waitForTimeInterval:1]; [[viewTester usingLabel:@"UI界面"] tap]; @@ -46,11 +43,7 @@ -(void) test2EnableDataCollect{ function:设置GDPR失效 **/ [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"+ GDPR(数据保护)"] tap]; -// //GDPR生效 -// [[viewTester usingLabel:@"GDPR生效"] tap]; - [Growing setDataCollectionEnabled:NO]; + [Growing setDataTrackEnabled:NO]; [MockEventQueue.sharedQueue cleanQueue]; [tester waitForTimeInterval:1]; [[viewTester usingLabel:@"UI界面"] tap]; @@ -58,8 +51,7 @@ -(void) test2EnableDataCollect{ NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; XCTAssertEqual(clckEventArray.count,0); //GDPR失效 - [Growing setDataCollectionEnabled:YES]; -// [[viewTester usingLabel:@"GDPR失效"] tap]; + [Growing setDataTrackEnabled:YES]; [tester waitForTimeInterval:1]; [[viewTester usingLabel:@"协议/接口"] tap]; [[viewTester usingLabel:@"clck请求"] tap]; @@ -72,7 +64,6 @@ -(void) test2EnableDataCollect{ //判断单击列表是否正确 NSDictionary *chevent=[clckEventArray1 objectAtIndex:clckEventArray1.count-1]; NSLog(@"###%@",chevent); - // XCTAssertEqualObjects(chevent[@"textValue"], @"send clck event"); XCTAssertEqual(1, 1); NSLog(@"设置GDPR失效,采取数据,测试通过--passed!"); } diff --git a/Example/ExampleTests/SDK Method Test/GetConfigurationTest.m b/Example/ExampleTests/MethodTest/GetConfigurationTest.m similarity index 100% rename from Example/ExampleTests/SDK Method Test/GetConfigurationTest.m rename to Example/ExampleTests/MethodTest/GetConfigurationTest.m diff --git a/Example/ExampleTests/SDK Method Test/GetEnableLogTest.h b/Example/ExampleTests/MethodTest/GetEnableLogTest.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/GetEnableLogTest.h rename to Example/ExampleTests/MethodTest/GetEnableLogTest.h diff --git a/Example/ExampleTests/SDK Method Test/GetEnableLogTest.m b/Example/ExampleTests/MethodTest/GetEnableLogTest.m similarity index 76% rename from Example/ExampleTests/SDK Method Test/GetEnableLogTest.m rename to Example/ExampleTests/MethodTest/GetEnableLogTest.m index 9ca5a8052..5037008dd 100644 --- a/Example/ExampleTests/SDK Method Test/GetEnableLogTest.m +++ b/Example/ExampleTests/MethodTest/GetEnableLogTest.m @@ -17,10 +17,6 @@ -(void)test1GetEnableLog{ /** Function:获取显示日志状态 **/ - // [[viewTester usingLabel:@"接口"] tap]; - // [[viewTester usingLabel:@"+ getEnableLog(日志开关状态)"] tap]; - // [[viewTester usingLabel:@"获取日志状态"] tap]; - // Config GrowingIO GrowingConfiguration *configuration = [[GrowingConfiguration alloc] initWithProjectId:kGrowingProjectId launchOptions:nil]; [configuration setLogEnabled:YES]; @@ -28,8 +24,6 @@ -(void)test1GetEnableLog{ NSLog(@"日志打开状态,%@",log?@"YES":@"NO"); NSString *logab = log ? @"1" : @"0"; [tester waitForTimeInterval:1]; - // UILabel *logab=[tester waitForViewWithAccessibilityLabel:@"ShowLogDeInfo"]; - //NSLog(@"****获取发送时间间隔****:%@",slab.text); if(![logab isEqualToString:@""]) { XCTAssertEqualObjects(logab, @"1"); diff --git a/Example/ExampleTests/SDK Method Test/GetIDsTest.h b/Example/ExampleTests/MethodTest/GetIDsTest.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/GetIDsTest.h rename to Example/ExampleTests/MethodTest/GetIDsTest.h diff --git a/Example/ExampleTests/SDK Method Test/GetIDsTest.m b/Example/ExampleTests/MethodTest/GetIDsTest.m similarity index 79% rename from Example/ExampleTests/SDK Method Test/GetIDsTest.m rename to Example/ExampleTests/MethodTest/GetIDsTest.m index 4e6576b1f..67624d341 100644 --- a/Example/ExampleTests/SDK Method Test/GetIDsTest.m +++ b/Example/ExampleTests/MethodTest/GetIDsTest.m @@ -20,7 +20,6 @@ -(void)test1GetDeviceID{ NSString *slab = [Growing getDeviceId]; [tester waitForTimeInterval:1]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowDevId"]; NSLog(@"****获取设备ID****:%@",slab); if(![slab isEqualToString:@""]) { @@ -42,7 +41,6 @@ -(void)test2GetUID{ */ [MockEventQueue.sharedQueue cleanQueue]; [tester waitForTimeInterval:1]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowUid"]; NSString *slab = [Growing getDeviceId]; NSLog(@"****获取当前UID****:%@",slab); if(![slab isEqualToString:@""]) @@ -62,11 +60,6 @@ -(void)test3GetSID{ Function:测试getSessionId */ [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"+ FlushInterval(发送数据间隔)"] tap]; -// [[viewTester usingLabel:@"获取当前访问ID"] tap]; -// [tester waitForTimeInterval:5]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowVistId"]; NSString *slab = [Growing getSessionId]; NSLog(@"****获取当前访问ID****:%@",slab); if(![slab isEqualToString:@""]) diff --git a/Example/ExampleTests/SDK Method Test/MediatorTest.m b/Example/ExampleTests/MethodTest/MediatorTest.m similarity index 100% rename from Example/ExampleTests/SDK Method Test/MediatorTest.m rename to Example/ExampleTests/MethodTest/MediatorTest.m diff --git a/Example/ExampleTests/SDK Method Test/TrackViewTest.h b/Example/ExampleTests/MethodTest/TrackViewTest.h similarity index 100% rename from Example/ExampleTests/SDK Method Test/TrackViewTest.h rename to Example/ExampleTests/MethodTest/TrackViewTest.h diff --git a/Example/ExampleTests/MethodTest/TrackViewTest.m b/Example/ExampleTests/MethodTest/TrackViewTest.m new file mode 100644 index 000000000..5420cf0f9 --- /dev/null +++ b/Example/ExampleTests/MethodTest/TrackViewTest.m @@ -0,0 +1,32 @@ +// +// TrackViewTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/8/22. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "TrackViewTest.h" +#import "MockEventQueue.h" +#import "GrowingTracker.h" + +@implementation TrackViewTest + +-(void) test1TackviewTrue{ + /** + function:测试enableAllWebViews + **/ + [Growing setDataTrackEnabled:YES]; + +} + + +-(void) test2TackviewFalse{ + /** + function:测试enableAllWebViews + **/ + + [Growing setDataTrackEnabled:NO]; +} + +@end diff --git a/Example/ExampleTests/protocol test and api test/ClckEventsTest.h b/Example/ExampleTests/ProtocolAndApi/ClickEventsTest.h similarity index 80% rename from Example/ExampleTests/protocol test and api test/ClckEventsTest.h rename to Example/ExampleTests/ProtocolAndApi/ClickEventsTest.h index f768d6ab2..a52377566 100644 --- a/Example/ExampleTests/protocol test and api test/ClckEventsTest.h +++ b/Example/ExampleTests/ProtocolAndApi/ClickEventsTest.h @@ -8,6 +8,6 @@ #import -@interface ClckEventsTest : KIFTestCase +@interface ClickEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ProtocolAndApi/ClickEventsTest.m b/Example/ExampleTests/ProtocolAndApi/ClickEventsTest.m new file mode 100644 index 000000000..dc148045b --- /dev/null +++ b/Example/ExampleTests/ProtocolAndApi/ClickEventsTest.m @@ -0,0 +1,200 @@ +// +// ClckEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/2/24. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "ClickEventsTest.h" +#import "MockEventQueue.h" +#import "NoburPoMeaProCheck.h" +#import "GrowingTracker.h" +@implementation ClickEventsTest + +- (void)beforeEach { + //设置userid,确保cs1字段不空 + [Growing setLoginUserId:@"test"]; + +} + +- (void)afterEach { + +} + +- (void)test7DialogBtnCheck{ + /** + function:对话框按钮点击,检测clck事件,模拟器上没有数据发送,真机上有 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"UI界面"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"UI界面"] tap]; + //添加向下滚动操作,减少用例间相互影响 + [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"AttributeLabel"] tap]; + [[viewTester usingLabel:@"ShowAlert"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"取消"] tap]; + [tester waitForTimeInterval:3]; + NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; + //是否发送clck事件,需要确认 + if(clckEventArray.count>=2) + { + //判断单击列表是否正确 + NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; + NSDictionary *clkchr=[NoburPoMeaProCheck clickEventCheck:chevent]; + //NSLog(@"Check Result:%@",clkchr); + XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); + XCTAssertEqualObjects(clkchr[@"ProCheck"][@"chres"],@"different"); + XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); + NSLog(@"对话框按钮点击,检测clck事件测试通过---Passed!"); + } + else + { + NSLog(@"对话框按钮点击,检测clck事件测试不通过:%@!",clckEventArray); + XCTAssertEqual(1, 0); + } +} + +- (void)test10BtnGIONotTrackClick{ + /** + function:setDataTrackEnabled:NO,不发送clck事件 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [Growing setDataTrackEnabled:NO]; + [[viewTester usingLabel:@"UI界面"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"UI界面"] tap]; + //添加向下滚动操作,减少用例间相互影响 + [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"AttributeLabel"] tap]; + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"BtnGIODNTR"] tap]; + [tester waitForTimeInterval:3]; + NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; + if (clckEventArray==NULL) { + XCTAssertEqual(1, 1); + NSLog(@"setDataTrackEnabled:NO,不发送clck事件测试通过---Passed!"); + } else { + NSLog(@"setDataTrackEnabled:NO,不发送clck事件测试不通过:%@!",clckEventArray); + XCTAssertEqual(1, 0); + } + //恢复track状态 + [Growing setDataTrackEnabled:YES]; +} + +- (void)test11ColorButtonCheck{ + /** + function:单击ColorButton,检测clck事件 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"UI界面"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"UI界面"] tap]; + //添加向下滚动操作,减少用例间相互影响 + [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"Simple UI Elements"] tap]; + [tester waitForTimeInterval:5]; + CGPoint point=CGPointMake(50,500); + [tester tapScreenAtPoint:point]; + [tester waitForTimeInterval:3]; + [[viewTester usingLabel:@"好的"] tap]; + NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; + if (clckEventArray.count>4) { + //TODO:3.0 测量协议修改 +// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; +// XCTAssertEqualObjects(chevent[@"textValue"],@""); + //检测发送事件情况 +// NSDictionary *clkchr=[NoburPoMeaProCheck clickEventCheck:chevent]; + //NSLog(@"Check Result:%@",clkchr); +// NSArray *ekey=clkchr[@"KeysCheck"][@"EmptyKeys"]; +// XCTAssertEqual(ekey.count, 1); +// XCTAssertEqualObjects(clkchr[@"KeysCheck"][@"EmptyKeys"][0],@"textValue"); +// NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; +// XCTAssertEqual(reduc.count, 1); +// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); + NSLog(@"单击ColorButton,发送clck事件测试通过---Passed!"); + } else { + NSLog(@"单击ColorButton,发送clck事件测试不通过:%@!",clckEventArray); + XCTAssertEqual(1, 0); + } + +} + +- (void)test12ButtonWithImageViewCheck { + /** + function:单击ButtonWithImageView,检测clck事件 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"UI界面"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"UI界面"] tap]; + //添加向下滚动操作,减少用例间相互影响 + [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"Simple UI Elements"] tap]; + [tester waitForTimeInterval:1]; + CGPoint point=CGPointMake(130,500); + [tester tapScreenAtPoint:point]; + [tester waitForTimeInterval:3]; + [[viewTester usingLabel:@"好的"] tap]; + NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; + //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); + if(clckEventArray.count>4) { + //TODO:3.0 测量协议修改 +// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; +// XCTAssertEqualObjects(chevent[@"textValue"],@"邮件"); +// //检测发送事件情况 +// NSDictionary *clkchr=[NoburPoMeaProCheck clickEventCheck:chevent]; +// //NSLog(@"Check Result:%@",clkchr); +// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); +// NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; +// XCTAssertEqual(reduc.count, 1); +// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); + NSLog(@"单击ButtonWithImageView,发送clck事件测试通过---Passed!"); + } else { + NSLog(@"单击ButtonWithImageView,发送clck事件测试不通过:%@!",clckEventArray); + XCTAssertEqual(1, 0); + } + +} + +- (void)test13UIViewButtonCheck { + /** + function:单击UIViewButton,检测clck事件 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"UI界面"] tap]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"UI界面"] tap]; + //添加向下滚动操作,减少用例间相互影响 + [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; + [tester waitForTimeInterval:1]; + [[viewTester usingLabel:@"Simple UI Elements"] tap]; + [tester waitForTimeInterval:5]; + [[viewTester usingLabel:@"Fire"] tap]; + [tester waitForTimeInterval:3]; + [[viewTester usingLabel:@"好的"] tap]; + NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; + //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); + if (clckEventArray.count>3) { + //TODO:3.0 测量协议修改 +// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; +// //检测发送事件情况 +// NSDictionary *clkchr=[NoburPoMeaProCheck clickEventCheck:chevent]; +// //NSLog(@"Check Result:%@",clkchr); +// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); +// NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; +// XCTAssertEqual(reduc.count, 1); +// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); + NSLog(@"单击UIViewButton,发送clck事件测试通过---Passed!"); + } else { + NSLog(@"单击UIViewButton,发送clck事件测试不通过:%@!",clckEventArray); + XCTAssertEqual(1, 0); + } +} +@end diff --git a/Example/ExampleTests/ProtocolAndApi/PageEventsTest.m b/Example/ExampleTests/ProtocolAndApi/PageEventsTest.m new file mode 100644 index 000000000..821fc70b6 --- /dev/null +++ b/Example/ExampleTests/ProtocolAndApi/PageEventsTest.m @@ -0,0 +1,50 @@ +// +// PageEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 31/03/2018. +// Copyright © 2018 GrowingIO. All rights reserved. +// + +#import +#import "MockEventQueue.h" +#import "GrowingTestHelper.h" + +static NSString *pageType = @"PAGE"; + +@interface PageEventsTest : KIFTestCase + +@end + +@implementation PageEventsTest + + +- (void)beforeEach { + +} + +- (void)afterEach { + +} + + +- (void)setUp { + [super setUp]; +} + +- (void)tearDown { + [super tearDown]; +} + +//统计 tl 为 title 的event个数 +- (NSInteger)calculateEventsCountWithTitle:(NSString *)title fromEventsArray:(NSArray *)array { + NSInteger eventsCount = 0; + for (NSDictionary *dic in array) { + if ([dic[@"tl"] isEqualToString:title]) { + eventsCount += 1; + } + } + return eventsCount; +} + +@end diff --git a/Example/ExampleTests/protocol test and api test/ChgEventsTest.h b/Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.h similarity index 78% rename from Example/ExampleTests/protocol test and api test/ChgEventsTest.h rename to Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.h index 264a6a959..b488e4ece 100644 --- a/Example/ExampleTests/protocol test and api test/ChgEventsTest.h +++ b/Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.h @@ -8,6 +8,6 @@ #import -@interface ChgEventsTest : KIFTestCase +@interface ViewChangeEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.m b/Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.m new file mode 100644 index 000000000..aa4dfc810 --- /dev/null +++ b/Example/ExampleTests/ProtocolAndApi/ViewChangeEventsTest.m @@ -0,0 +1,74 @@ +// +// ChgEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/2/28. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "ViewChangeEventsTest.h" +#import "MockEventQueue.h" +#import "NoburPoMeaProCheck.h" +#import "GrowingTracker.h" +@implementation ViewChangeEventsTest + + +- (void)setUp{ + //设置userid,确保cs1字段不空 + [Growing setLoginUserId:@"test"]; + +} + +-(void)test1TextFields{ + /** + function:TextField输出内容,检测chng事件 + **/ + [MockEventQueue.sharedQueue cleanQueue]; + [[viewTester usingLabel:@"UI界面"] tap]; + [[viewTester usingLabel:@"Text Fields"] tap]; + [tester tapViewWithAccessibilityLabel:@"fisrtTF"]; + [tester enterTextIntoCurrentFirstResponder:@"Good"]; + [tester waitForTimeInterval:1]; + [tester tapViewWithAccessibilityLabel:@"secondTF"]; + [tester waitForTimeInterval:2]; + NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; + if (chngEventArray.count>0) { + //判断单击列表是否正确 + NSDictionary *chevent=[chngEventArray objectAtIndex:chngEventArray.count-1]; + //检测发送事件情况 + NSDictionary *chngchr=[NoburPoMeaProCheck viewChangeEventCheck:chevent]; + NSLog(@"Check result:%@",chngchr); + XCTAssertEqualObjects(chngchr[@"KeysCheck"][@"chres"], @"Passed"); + NSArray *incr=chngchr[@"ProCheck"][@"incre"]; + XCTAssertEqual(incr.count, 1); + XCTAssertEqualObjects(chngchr[@"ProCheck"][@"incre"][0],@"index"); + NSLog(@"TextField输出内容,检测chng事件测试通过---Passed!"); + } else { + NSLog(@"TextField输出内容,检测chng事件,测试不通过!没有发送chng事件"); + XCTAssertEqual(0, 1); + } + +} + +-(void)test2DataPicker{ + /** + function:日期控件操作,不发送chng事件 + **/ + [[viewTester usingLabel:@"协议/接口"] tap]; + //单击两次返回列表页 + [[viewTester usingLabel:@"协议/接口"] tap]; + [[viewTester usingLabel:@"chng请求"] tap]; + [MockEventQueue.sharedQueue cleanQueue]; + NSArray *date = @[@"June", @"10", @"2019"]; + [tester selectDatePickerValue:date]; + [tester waitForTimeInterval:2]; + NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; + if (chngEventArray == NULL) { + XCTAssertEqual(1, 1); + NSLog(@"日期控件操作,不发送chng事件测试通过---Passed!"); + } else { + NSLog(@"日期控件操作,不发送chng事件,测试不通过!发送了chng事件"); + XCTAssertEqual(0, 1); + } +} +@end diff --git a/Example/ExampleTests/protocol test and api test/VstEventsTest.h b/Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.h similarity index 79% rename from Example/ExampleTests/protocol test and api test/VstEventsTest.h rename to Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.h index e17e67970..336f5810f 100644 --- a/Example/ExampleTests/protocol test and api test/VstEventsTest.h +++ b/Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.h @@ -8,6 +8,6 @@ #import -@interface VstEventsTest : KIFTestCase +@interface VisitorEventsTest : KIFTestCase @end diff --git a/Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.m b/Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.m new file mode 100644 index 000000000..c5183edb6 --- /dev/null +++ b/Example/ExampleTests/ProtocolAndApi/VisitorEventsTest.m @@ -0,0 +1,53 @@ +// +// VstEventsTest.m +// GIOAutoTests +// +// Created by GrowingIO on 2018/2/22. +// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. +// + +#import "VisitorEventsTest.h" +#import "MockEventQueue.h" +#import "GrowingTestHelper.h" +#import "NoburPoMeaProCheck.h" +#import "GrowingTracker.h" + +@implementation VisitorEventsTest + +- (void)beforeEach { + //设置userid,确保cs1字段不空 + [Growing setLoginUserId:@"test"]; +} +- (void)afterEach { + //[GrowingTestHelper ExiteApp]; +} + +-(void)test1SetLocation{ + /** + function:SetLocation触发,从null -> 非null 发一次。非null - 非null不发vst + **/ + NSString *oldSession = [Growing getSessionId]; + XCTAssertNotNil(oldSession); + [Growing cleanLocation]; + [MockEventQueue.sharedQueue cleanQueue]; + [Growing setLocation:[@30.11 doubleValue] longitude:[@32.22 doubleValue]]; + [tester waitForTimeInterval:1]; + NSArray *vstEventArray = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; + //NSLog(@"VST事件:%@",vstEventArray); + if (vstEventArray.count>0) + { + NSDictionary *vstchr=[vstEventArray objectAtIndex:vstEventArray.count-1]; + NSLog(@"Check Result:%@",vstchr); + XCTAssertEqualObjects(vstchr[@"latitude"], @30.11); + XCTAssertEqualObjects(vstchr[@"longitude"], @32.22); + NSLog(@"setLocation 从null -> 非null 发vst,测试通过--Passed!"); + } + else + { + NSLog(@"setLocation 从null -> 非null 发vst,测试不通过:%@",vstEventArray); + XCTAssertEqual(1, 0); + } + +} + +@end diff --git a/Example/ExampleTests/SDK Method Test/DailyDataLimit.m b/Example/ExampleTests/SDK Method Test/DailyDataLimit.m deleted file mode 100644 index 3b319cf6a..000000000 --- a/Example/ExampleTests/SDK Method Test/DailyDataLimit.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// DailyDataLimit.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/6/19. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "DailyDataLimit.h" -#import "MockEventQueue.h" -#import "GrowingTracker.h" - -@implementation DailyDataLimit - --(void)test1GetDailyDataLimit{ - /** - function:获取蜂窝当天数据限额 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"获取蜂窝数据"] tap]; - // UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowDataLimt"]; - // Config GrowingIO - - // NSLog(@"****获取蜂窝数据****:%@"); - //XCTAssertEqual(a, @10485); - NSLog(@"获取蜂窝数据,测试通过---passed"); - // if(![a isEquals:@0]) - // { - // - // } - // else - // { - // NSLog(@"获取蜂窝数据,测试失败,获取数据限额错误:%@",slab.text); - // XCTAssertEqual(1, 0); - // } -} - --(void) test2SetDailyDataLimit{ - /** - function:设置蜂窝当天数据限额 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - // [[viewTester usingLabel:@"接口"] tap]; - // [[viewTester usingLabel:@"+ DailyDataLimit(蜂窝数据)"] tap]; - // [tester tapViewWithAccessibilityLabel:@"SetDataLimit"]; - // [tester enterTextIntoCurrentFirstResponder:@"3000"]; - // [[viewTester usingLabel:@"设置上限"] tap]; - // [tester waitForTimeInterval:1]; - // [[viewTester usingLabel:@"获取蜂窝数据"] tap]; - //NSLog(@"****获取蜂窝数据****:%@",slab.text); - // if(![slab.text isEqualToString:@""]) - // { - // XCTAssertEqualObjects(slab.text, @"3000 K"); - // NSLog(@"设置蜂窝当天数据限额,测试通过---passed"); - // } - // else - // { - // NSLog(@"设置蜂窝当天数据限额,测试失败,获取数据限额错误:%@",slab.text); - // XCTAssertEqual(1, 0); - // } -} -@end diff --git a/Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.m b/Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.m deleted file mode 100644 index 84216d567..000000000 --- a/Example/ExampleTests/SDK Method Test/FlushIntervalAPITest.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// FlushIntervalAPITest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/6/19. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "FlushIntervalAPITest.h" -#import "MockEventQueue.h" -#import "GrowingTracker.h" - -@implementation FlushIntervalAPITest - --(void)test1GetFlushInterVal{ - /* - Function:获取数据采集时间 - */ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"+ FlushInterval(发送数据间隔)"] tap]; -// [[viewTester usingLabel:@"获取间隔"] tap]; -// [tester waitForTimeInterval:1]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowFTime"]; -// //NSLog(@"****获取发送时间间隔****:%@",slab.text); -// if(![slab.text isEqualToString:@""]) -// { -// XCTAssertEqualObjects(slab.text, @"15.00 s"); -// NSLog(@"获取发送时间间隔,测试通过---passed"); -// } -// else -// { -// NSLog(@"获取发送时间间隔,测试失败,获取时间错误:%@",slab.text); -// XCTAssertEqual(1, 0); -// } - - -} - --(void)test2SetFlushInterVal{ - /* - Function:设置数据采集时间 - */ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"+ FlushInterval(发送数据间隔)"] tap]; -// [tester tapViewWithAccessibilityLabel:@"SetFTime"]; -// [tester enterTextIntoCurrentFirstResponder:@"50"]; -// [[viewTester usingLabel:@"设置时间"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"获取间隔"] tap]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"ShowFTime"]; -// //NSLog(@"****获取发送时间间隔****:%@",slab.text); -// if(![slab.text isEqualToString:@""]) -// { -// XCTAssertEqualObjects(slab.text, @"50.00 s"); -// NSLog(@"获取发送时间间隔,测试通过---passed"); -// } -// else -// { -// NSLog(@"获取发送时间间隔,测试失败,获取时间错误:%@",slab.text); -// XCTAssertEqual(1, 0); -// } -} -@end diff --git a/Example/ExampleTests/SDK Method Test/TrackViewTest.m b/Example/ExampleTests/SDK Method Test/TrackViewTest.m deleted file mode 100644 index 60a0832e1..000000000 --- a/Example/ExampleTests/SDK Method Test/TrackViewTest.m +++ /dev/null @@ -1,70 +0,0 @@ -// -// TrackViewTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/8/22. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "TrackViewTest.h" -#import "MockEventQueue.h" -#import "GrowingTracker.h" - -@implementation TrackViewTest - --(void) test1TackviewTrue{ - /** - function:测试enableAllWebViews - **/ -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"+ GDPR(数据保护)"] tap]; -// [[viewTester usingLabel:@"采集"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"获取状态"] tap]; -// [tester waitForTimeInterval:1]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"trackviewstatus"]; - [Growing setDataCollectionEnabled:YES]; - // [Growing isTrackingWebView]; - //NSLog(@"****获取当前trackingWebView****:%@",slab.text); -// if(![slab.text isEqualToString:@""]) -// { -// XCTAssertEqualObjects(slab.text, @"采集中..."); -// NSLog(@"测试enableAllWebViews,测试通过---passed"); -// } -// else -// { -// NSLog(@"测试enableAllWebViews,测试失败,enableAllWebView状态:%@",slab.text); -// XCTAssertEqual(1, 0); -// } -} - - --(void) test2TackviewFalse{ - /** - function:测试enableAllWebViews - **/ -// [[viewTester usingLabel:@"接口"] tap]; -// [[viewTester usingLabel:@"+ GDPR(数据保护)"] tap]; -// [[viewTester usingLabel:@"不采集"] tap]; -// [MockEventQueue.sharedQueue cleanQueue]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"获取状态"] tap]; -// [tester waitForTimeInterval:1]; -// UILabel *slab=[tester waitForViewWithAccessibilityLabel:@"trackviewstatus"]; - [Growing setDataCollectionEnabled:NO]; - - //NSLog(@"****获取当前trackingWebView****:%@",slab.text); -// if(![slab.text isEqualToString:@""]) -// { -// XCTAssertEqualObjects(slab.text, @"不采集!!!"); -// NSLog(@"测试enableAllWebView为False,测试通过---passed"); -// } -// else -// { -// NSLog(@"测试enableAllWebViews为False,测试失败,enableAllWebView状态:%@",slab.text); -// XCTAssertEqual(1, 0); -// } -} - -@end diff --git a/Example/ExampleTests/protocol test and api test/ChgEventsTest.m b/Example/ExampleTests/protocol test and api test/ChgEventsTest.m deleted file mode 100644 index 140060346..000000000 --- a/Example/ExampleTests/protocol test and api test/ChgEventsTest.m +++ /dev/null @@ -1,185 +0,0 @@ -// -// ChgEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/2/28. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "ChgEventsTest.h" -#import "MockEventQueue.h" -#import "NoburPoMeaProCheck.h" -#import "GrowingTracker.h" -@implementation ChgEventsTest - - -- (void)setUp{ - //设置userid,确保cs1字段不空 - [Growing setLoginUserId:@"test"]; - -} - --(void)test1TextFields{ - /** - function:TextField输出内容,检测chng事件 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [[viewTester usingLabel:@"Text Fields"] tap]; - [tester tapViewWithAccessibilityLabel:@"fisrtTF"]; - [tester enterTextIntoCurrentFirstResponder:@"Good"]; - [tester waitForTimeInterval:1]; - [tester tapViewWithAccessibilityLabel:@"secondTF"]; - [tester waitForTimeInterval:2]; - NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; - //NSLog(@"chng事件:%@",chngEventArray); - if(chngEventArray.count>0) - { - //判断单击列表是否正确 - NSDictionary *chevent=[chngEventArray objectAtIndex:chngEventArray.count-1]; - //检测发送事件情况 - NSDictionary *chngchr=[NoburPoMeaProCheck ChngEventCheck:chevent]; - NSLog(@"Check result:%@",chngchr); - XCTAssertEqualObjects(chngchr[@"KeysCheck"][@"chres"], @"Passed"); - NSArray *incr=chngchr[@"ProCheck"][@"incre"]; - XCTAssertEqual(incr.count, 1); - XCTAssertEqualObjects(chngchr[@"ProCheck"][@"incre"][0],@"index"); - NSLog(@"TextField输出内容,检测chng事件测试通过---Passed!"); - } - else - { - NSLog(@"TextField输出内容,检测chng事件,测试不通过!没有发送chng事件"); - XCTAssertEqual(0, 1); - } - -} - -//-(void)test2SearchBar{ -// /** -// function:SearchBar输出内容,检测chng事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// -// //受第一个测试用例的影响,点击两次以保证恢复到正确的页面 -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"chng请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"SearchBarTest"]; -// [tester enterTextIntoCurrentFirstResponder:@"Good"]; -// [tester tapViewWithAccessibilityLabel:@"Search"]; -// [tester waitForTimeInterval:2]; -// NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; -// //NSLog(@"chng事件:%@",chngEventArray); -// if(chngEventArray.count>0) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[chngEventArray objectAtIndex:chngEventArray.count-1]; -// //检测发送事件情况 -// NSDictionary *chngchr=[NoburPoMeaProCheck ChngEventCheck:chevent]; -// //NSLog(@"Check result:%@",chngchr); -// XCTAssertEqualObjects(chngchr[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(chngchr[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"SearchBar输出内容,检测chng事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"SearchBar输出内容,检测chng事件,测试不通过!没有发送chng事件"); -// XCTAssertEqual(0, 1); -// } -//} - -//-(void)test3UserNamePsd{ -// /** -// function:用户名和密码,检测chng事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"chng请求"] tap]; -// [tester tapViewWithAccessibilityLabel:@"UserName"]; -// [tester enterTextIntoCurrentFirstResponder:@"SXF"]; -// [tester tapViewWithAccessibilityLabel:@"PassWord"]; -// [tester enterTextIntoCurrentFirstResponder:@"123426"]; -// [tester waitForTimeInterval:2]; -// NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; -// //NSLog(@"chng事件:%@",chngEventArray); -// if(chngEventArray.count>0) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[chngEventArray objectAtIndex:chngEventArray.count-1]; -// //检测发送事件情况 -// NSDictionary *chngchr=[NoburPoMeaProCheck ChngEventCheck:chevent]; -// //NSLog(@"Check result:%@",chngchr); -// NSArray *empty=chngchr[@"KeysCheck"][@"EmptyKeys"]; -// XCTAssertEqual(empty.count, 1); -// //TextField不采集输入的内容 -// XCTAssertEqualObjects(chngchr[@"KeysCheck"][@"EmptyKeys"][0], @"textValue"); -// XCTAssertEqualObjects(chngchr[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"用户名和密码,检测chng事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"用户名和密码,检测chng事件,测试不通过!没有发送chng事件"); -// XCTAssertEqual(0, 1); -// } -//} -//-(void)test4TextView{ -// /** -// function:textview操作,检测chng事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //单击两次返回列表页 -// [[viewTester usingLabel:@"UI界面"] tap]; -// [[viewTester usingLabel:@"NotUIControl"] tap]; -// [tester tapViewWithAccessibilityLabel:@"TextChgTest"]; -// [tester enterTextIntoCurrentFirstResponder:@"This is a test content!"]; -// [tester waitForTimeInterval:1]; -// [tester tapViewWithAccessibilityLabel:@"return"]; -// [tester waitForTimeInterval:2]; -// NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; -// //NSLog(@"chng事件:%@",chngEventArray); -// if(chngEventArray.count>0) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[chngEventArray objectAtIndex:chngEventArray.count-1]; -// //检测发送事件情况 -// NSDictionary *chngchr=[NoburPoMeaProCheck ChngEventCheck:chevent]; -// //NSLog(@"Check result:%@",chngchr); -// NSArray *empty=chngchr[@"KeysCheck"][@"EmptyKeys"]; -// XCTAssertEqual(empty.count, 1); -// XCTAssertEqualObjects(chngchr[@"KeysCheck"][@"EmptyKeys"][0], @"textValue"); -// XCTAssertEqualObjects(chngchr[@"ProCheck"][@"chres"], @"same"); -// NSLog(@"textview操作,检测chng事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"textview操作,检测chng事件,测试不通过!没有发送chng事件"); -// XCTAssertEqual(0, 1); -// } -//} - --(void)test2DataPicker{ - /** - function:日期控件操作,不发送chng事件 - **/ - [[viewTester usingLabel:@"协议/接口"] tap]; - //单击两次返回列表页 - [[viewTester usingLabel:@"协议/接口"] tap]; - [[viewTester usingLabel:@"chng请求"] tap]; - [MockEventQueue.sharedQueue cleanQueue]; - NSArray *date = @[@"June", @"10", @"2019"]; - [tester selectDatePickerValue:date]; - [tester waitForTimeInterval:2]; - NSArray *chngEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CHANGE"]; - //NSLog(@"chng事件:%@",chngEventArray); - if (chngEventArray == NULL) - { - XCTAssertEqual(1, 1); - NSLog(@"日期控件操作,不发送chng事件测试通过---Passed!"); - } - else - { - NSLog(@"日期控件操作,不发送chng事件,测试不通过!发送了chng事件"); - XCTAssertEqual(0, 1); - } -} -@end diff --git a/Example/ExampleTests/protocol test and api test/ClckEventsTest.m b/Example/ExampleTests/protocol test and api test/ClckEventsTest.m deleted file mode 100644 index ea8673342..000000000 --- a/Example/ExampleTests/protocol test and api test/ClckEventsTest.m +++ /dev/null @@ -1,503 +0,0 @@ -// -// ClckEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/2/24. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "ClckEventsTest.h" -#import "MockEventQueue.h" -#import "NoburPoMeaProCheck.h" -#import "GrowingTracker.h" -@implementation ClckEventsTest - -- (void)beforeEach { - //设置userid,确保cs1字段不空 - [Growing setLoginUserId:@"test"]; - -} - -- (void)afterEach { - -} - - -//-(void)test1BtnClick{ -// /** -// function:按钮点击操作,测试clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Buttons & AlertView"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Button"] tap]; -// -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// if(clckEventArray.count>=3) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// //XCTAssertEqualObjects(chevent[@"textValue"],@"Button"); -// //检测发送事件情况 -// NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; -// //NSLog(@"Check Result:%@",clkchr); -// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqual(clkchr[@"ProCheck"][@"chres"],@"same"); -// NSLog(@"按钮点击操作,测试clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"按钮点击操作,测试clck事件没有发送事件测试不通过,%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -// [[viewTester usingLabel:@"OK"] tap]; -//} - -//-(void)test2BtnClickPPTMCheck{ -// /** -// function:按钮点击操作,测试clck事件与page事件的p,ptm字段是否一致 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Buttons & AlertView"] tap]; -// [[viewTester usingLabel:@"Button"] tap]; -// -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// NSDictionary *clickchr=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// -// NSArray *pageEventArray = [MockEventQueue.sharedQueue eventsFor:@"PAGE"]; -// //NSLog(@"page事件:%@",[pageEventArray objectAtIndex:pageEventArray.count-1]); -// NSDictionary *pagechr=[pageEventArray objectAtIndex:pageEventArray.count-1]; -// if(clickchr.count>0 && pagechr.count>0) -// { -// XCTAssertEqualObjects(clickchr[@"pageName"],pagechr[@"pageName"]); -// XCTAssertEqualObjects(clickchr[@"pageShowTimestamp"],pagechr[@"pageShowTimestamp"]); -// NSLog(@"检测clck事件与page事件的p,ptm字段的一致性测试通过---Passed!"); -// } -// else -// { -// NSLog(@"检测clck事件与page事件的p,ptm字段的一致性测试不通过:%@!",pagechr); -// XCTAssertEqual(1, 0); -// } -// [[viewTester usingLabel:@"OK"] tap]; -//} - -//-(void)test3BtnSwipeCheck{ -// /** -// function:拖拽按钮,检测clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Buttons & AlertView"] tap]; -// [tester swipeViewWithAccessibilityLabel:@"Button" inDirection:KIFSwipeDirectionRight]; -// -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件个数:%lu",(unsigned long)clckEventArray.count); -// if(clckEventArray.count==6) -// { -// XCTAssertEqual(1, 1); -// NSLog(@"拖拽按钮,不发送clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"拖拽按钮,不发送clck事件不测试通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -//} - -//-(void)test4LongPressCheck{ -// /** -// function:按下并抬起按钮,检测clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Buttons & AlertView"] tap]; -// [[viewTester usingLabel:@"Button"] longPress]; -// -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件个数:%lu",(unsigned long)clckEventArray.count); -// if(clckEventArray.count>=3) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// //NSLog(@"clck事件:%@",chevent); -// XCTAssertEqualObjects(chevent[@"textValue"],@"Button"); -// //检测发送事件情况 -// NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; -// //NSLog(@"Check Result:%@",clkchr); -// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"chres"],@"same"); -// NSLog(@"按下并抬起按钮,检测clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"按下并抬起按钮,检测clck事件没有发送事件测试不通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -// [[viewTester usingLabel:@"OK"] tap]; -//} - -//-(void)test2SegmentCheck{ -// /** -// function:多选控件点击,clck事件检测 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Simple UI Elements"] tap]; -// [[viewTester usingLabel:@"Second"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// if(clckEventArray.count>=3) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// //NSLog(@"Clck事件:%@",chevent); -// XCTAssertEqualObjects(chevent[@"textValue"],@"Second"); -// //检测发送事件情况 -// NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; -// NSLog(@"Check Result:%@",clkchr); -// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); -// NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(reduc.count, 1); -// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); -// NSLog(@"多选控件点击,clck事件检测测试通过---Passed!"); -// } -// else -// { -// NSLog(@"多选控件点击,clck事件检测没有发送事件测试不通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -//} - -//-(void)test6TabelViewCellCheck{ -// /** -// function:单击列表行,检测clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Simple UI Elements"] tap]; -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// if(clckEventArray.count>=2) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// XCTAssertEqualObjects(chevent[@"textValue"],@"Simple UI Elements"); -// //检测发送事件情况 -// NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; -// //NSLog(@"Check Result:%@",clkchr); -// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); -// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"chres"],@"same"); -// NSLog(@"单击列表行,检测clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"单击列表行,检测clck事件测试不通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -//} - --(void)test7DialogBtnCheck{ - /** - function:对话框按钮点击,检测clck事件,模拟器上没有数据发送,真机上有 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"UI界面"] tap]; - //添加向下滚动操作,减少用例间相互影响 - [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"AttributeLabel"] tap]; - [[viewTester usingLabel:@"ShowAlert"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"取消"] tap]; - [tester waitForTimeInterval:3]; - NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; - //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); - //NSLog(@"Clck 事件个数:%lu",clckEventArray.count); - //是否发送clck事件,需要确认 - if(clckEventArray.count>=2) - { - //判断单击列表是否正确 - NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; - NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; - //NSLog(@"Check Result:%@",clkchr); - XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); - XCTAssertEqualObjects(clkchr[@"ProCheck"][@"chres"],@"different"); - XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); - NSLog(@"对话框按钮点击,检测clck事件测试通过---Passed!"); - } - else - { - NSLog(@"对话框按钮点击,检测clck事件测试不通过:%@!",clckEventArray); - XCTAssertEqual(1, 0); - } -} -//-(void)test8PicClick{ -// /** -// function:点击图片,不发送clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"Page Control & ImageView"] tap]; -// [tester waitForTimeInterval:1]; -// UIStepper *repsStepper = (UIStepper*)[tester waitForViewWithAccessibilityLabel:@"PageImageView"]; -// CGPoint stepperCenter = [repsStepper.window convertPoint:repsStepper.center -// fromView:repsStepper.superview]; -// [tester tapScreenAtPoint:stepperCenter]; -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// if(clckEventArray.count==6) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// XCTAssertEqualObjects(chevent[@"textValue"],@"Page Control & ImageView"); -// XCTAssertEqual(1, 1); -// NSLog(@"点击图片,不发送clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"点击图片,不发送clck事件测试不通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -// -//} - -//-(void)test9NotUIClick{ -///** -// function:UITapGestureRecognizer触发,发送clck事件 -// **/ -// [MockEventQueue.sharedQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// //添加向下滚动操作,减少用例间相互影响 -// [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"NotUIControl"] tap]; -// //[[viewTester usingLabel:@"非UIControl,为UILabel"] tap]; -// [tester waitForTimeInterval:1]; -// //iphoneX -// CGPoint point=CGPointMake(179, 114); -// [tester tapScreenAtPoint:point]; -// [tester waitForTimeInterval:3]; -// NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; -// //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); -// if(clckEventArray.count>4) -// { -// //判断单击列表是否正确 -// NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-1]; -// XCTAssertEqualObjects(chevent[@"textValue"],@"非UIControl,为UILabel"); -// //检测发送事件情况 -// NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; -// //NSLog(@"Check Result:%@",clkchr); -// XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); -// NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(reduc.count, 1); -// XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); -// NSLog(@"UITapGestureRecognizer触发,发送clck事件测试通过---Passed!"); -// } -// else -// { -// NSLog(@"UITapGestureRecognizer触发,发送clck事件测试不通过:%@!",clckEventArray); -// XCTAssertEqual(1, 0); -// } -// [[viewTester usingLabel:@"好的"] tap]; -//} - --(void)test10BtnGIONotTrackClick{ - /** - function:setGrowingAttributesDonotTrack:YES,不发送clck事件 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"UI界面"] tap]; - //添加向下滚动操作,减少用例间相互影响 - [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"AttributeLabel"] tap]; - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"BtnGIODNTR"] tap]; - [tester waitForTimeInterval:3]; - NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; - //NSLog(@"Clck 事件:%@",clckEventArray); - if(clckEventArray==NULL) - { - XCTAssertEqual(1, 1); - NSLog(@"setGrowingAttributesDonotTrack:YES,不发送clck事件测试通过---Passed!"); - } - else - { - NSLog(@"setGrowingAttributesDonotTrack:YES,不发送clck事件测试不通过:%@!",clckEventArray); - XCTAssertEqual(1, 0); - } -} - --(void)test11ColorButtonCheck{ - /** - function:单击ColorButton,检测clck事件 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"UI界面"] tap]; - //添加向下滚动操作,减少用例间相互影响 - [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"Simple UI Elements"] tap]; - [tester waitForTimeInterval:5]; - CGPoint point=CGPointMake(50,500); - [tester tapScreenAtPoint:point]; - [tester waitForTimeInterval:3]; - [[viewTester usingLabel:@"好的"] tap]; - NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; - //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); - if(clckEventArray.count>4) - { - NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; - XCTAssertEqualObjects(chevent[@"textValue"],@""); - //检测发送事件情况 - NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; - //NSLog(@"Check Result:%@",clkchr); - NSArray *ekey=clkchr[@"KeysCheck"][@"EmptyKeys"]; - XCTAssertEqual(ekey.count, 1); - XCTAssertEqualObjects(clkchr[@"KeysCheck"][@"EmptyKeys"][0],@"textValue"); - NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; - XCTAssertEqual(reduc.count, 1); - XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); - NSLog(@"单击ColorButton,发送clck事件测试通过---Passed!"); - } - else - { - NSLog(@"单击ColorButton,发送clck事件测试不通过:%@!",clckEventArray); - XCTAssertEqual(1, 0); - } - -} - --(void)test12ButtonWithImageViewCheck{ - /** - function:单击ButtonWithImageView,检测clck事件 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"UI界面"] tap]; - //添加向下滚动操作,减少用例间相互影响 - [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"Simple UI Elements"] tap]; - [tester waitForTimeInterval:1]; - CGPoint point=CGPointMake(130,500); - [tester tapScreenAtPoint:point]; - [tester waitForTimeInterval:3]; - [[viewTester usingLabel:@"好的"] tap]; - NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; - //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); - if(clckEventArray.count>4) - { - NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; - XCTAssertEqualObjects(chevent[@"textValue"],@"邮件"); - //检测发送事件情况 - NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; - //NSLog(@"Check Result:%@",clkchr); - XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); - NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; - XCTAssertEqual(reduc.count, 1); - XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); - NSLog(@"单击ButtonWithImageView,发送clck事件测试通过---Passed!"); - } - else - { - NSLog(@"单击ButtonWithImageView,发送clck事件测试不通过:%@!",clckEventArray); - XCTAssertEqual(1, 0); - } - -} - --(void)test13UIViewButtonCheck{ - /** - function:单击UIViewButton,检测clck事件 - **/ - [MockEventQueue.sharedQueue cleanQueue]; - [[viewTester usingLabel:@"UI界面"] tap]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"UI界面"] tap]; - //添加向下滚动操作,减少用例间相互影响 - [tester scrollViewWithAccessibilityLabel:@"CollectionView" byFractionOfSizeHorizontal:0.0f vertical:10.0f]; - [tester waitForTimeInterval:1]; - [[viewTester usingLabel:@"Simple UI Elements"] tap]; - [tester waitForTimeInterval:5]; -// CGPoint point=CGPointMake(200,500); -// [tester tapScreenAtPoint:point]; - [[viewTester usingLabel:@"Fire"] tap]; - [tester waitForTimeInterval:3]; - [[viewTester usingLabel:@"好的"] tap]; - NSArray *clckEventArray = [MockEventQueue.sharedQueue eventsFor:@"VIEW_CLICK"]; - //NSLog(@"Clck 事件:%@",[clckEventArray objectAtIndex:clckEventArray.count-1]); - if(clckEventArray.count>3) - { - NSDictionary *chevent=[clckEventArray objectAtIndex:clckEventArray.count-2]; - //检测发送事件情况 - NSDictionary *clkchr=[NoburPoMeaProCheck ClckEventCheck:chevent]; - //NSLog(@"Check Result:%@",clkchr); - XCTAssertEqual(clkchr[@"KeysCheck"][@"chres"], @"Passed"); - NSArray *reduc=clkchr[@"ProCheck"][@"reduce"]; - XCTAssertEqual(reduc.count, 1); - XCTAssertEqualObjects(clkchr[@"ProCheck"][@"reduce"][0],@"index"); - NSLog(@"单击UIViewButton,发送clck事件测试通过---Passed!"); - } - else - { - NSLog(@"单击UIViewButton,发送clck事件测试不通过:%@!",clckEventArray); - XCTAssertEqual(1, 0); - } -} -@end diff --git a/Example/ExampleTests/protocol test and api test/VstEventsTest.m b/Example/ExampleTests/protocol test and api test/VstEventsTest.m deleted file mode 100644 index e82c91f76..000000000 --- a/Example/ExampleTests/protocol test and api test/VstEventsTest.m +++ /dev/null @@ -1,214 +0,0 @@ -// -// VstEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 2018/2/22. -// Copyright (C) 2018 Beijing Yishu Technology Co., Ltd. -// - -#import "VstEventsTest.h" -#import "MockEventQueue.h" -#import "GrowingTestHelper.h" -#import "NoburPoMeaProCheck.h" -#import "GrowingTracker.h" - -@implementation VstEventsTest - -- (void)beforeEach { - //设置userid,确保cs1字段不空 - [Growing setLoginUserId:@"test"]; -} -- (void)afterEach { - //[GrowingTestHelper ExiteApp]; -} - --(void)test1SetLocation{ - /** - function:SetLocation触发,从null -> 非null 发一次。非null - 非null不发vst - **/ - NSString *oldSession = [Growing getSessionId]; - XCTAssertNotNil(oldSession); - [Growing cleanLocation]; - [MockEventQueue.sharedQueue cleanQueue]; - [Growing setLocation:[@30.11 doubleValue] longitude:[@32.22 doubleValue]]; - [tester waitForTimeInterval:1]; - NSArray *vstEventArray = [MockEventQueue.sharedQueue eventsFor:@"VISIT"]; - //NSLog(@"VST事件:%@",vstEventArray); - if (vstEventArray.count>0) - { - NSDictionary *vstchr=[vstEventArray objectAtIndex:vstEventArray.count-1]; - - // NSDictionary *vstchr=[NoburPoMeaProCheck VstEventCheck:[vstEventArray objectAtIndex:vstEventArray.count-1]]; - NSLog(@"Check Result:%@",vstchr); - //目前无地理位置请求和广告标识 -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"chres"],@"Failed"); -// NSArray *incr=vstchr[@"ProCheck"][@"incre"]; -// NSArray *redu=vstchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(incr.count, 0); -// XCTAssertEqual(redu.count, 2); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][0],@"latitude"); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][1],@"longitude"); - XCTAssertEqualObjects(vstchr[@"latitude"], @30.11); - XCTAssertEqualObjects(vstchr[@"longitude"], @32.22); - NSLog(@"setLocation 从null -> 非null 发vst,测试通过--Passed!"); - } - else - { - NSLog(@"setLocation 从null -> 非null 发vst,测试不通过:%@",vstEventArray); - XCTAssertEqual(1, 0); - } - -} - -//-(void)test2UpdateUserId{ -// /** -// function:更新setUserid触发vst事件 -// **/ -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [tester scrollViewWithAccessibilityLabel:@"imp请求" byFractionOfSizeHorizontal:0.0f vertical:-10.0f]; -// [tester waitForTimeInterval:1]; -// [[viewTester usingLabel:@"+ (void)setUserId:(NSString *)userId;"] tap]; -// [[viewTester usingLabel:@"SetUserID"] tap]; -// [[viewTester usingLabel:@"ChangeUID"] tap]; -// [tester waitForTimeInterval:2]; -// NSArray *vstEventArray = [MockEventQueue eventsFor:@"VISIT"]; -// //NSLog(@"VST事件:%@",vstEventArray); -// if (vstEventArray.count>=1) -// { -// NSDictionary *vstchr=[NoburPoMeaProCheck VstEventCheck:[vstEventArray objectAtIndex:vstEventArray.count-1]]; -// //NSLog(@"Check Result:%@",vstchr); -// //判断检测结果,目前无地理位置请求和广告标识 -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"chres"],@"Failed"); -// NSArray *empty=vstchr[@"KeysCheck"][@"EmptyKeys"]; -// XCTAssertEqual(empty.count, 1); -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"EmptyKeys"][0],@"ui"); -// -// NSArray *incr=vstchr[@"ProCheck"][@"incre"]; -// NSArray *redu=vstchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(incr.count, 0); -// XCTAssertEqual(redu.count, 2); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][0],@"latitude"); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][1],@"longitude"); -// NSLog(@"更新setUserid触发vst事件,测试通过--Passed!"); -// } -// else -// { -// NSLog(@"更新setUserid触发vst事件,测试不通过:%@",vstEventArray); -// XCTAssertEqual(1, 0); -// } -//} - -//-(void)test3ColdBoot{ -// /** -// function:冷启动App,Vst事件检测 -// **/ -// //[MockEventQueue cleanQueue]; -// [tester waitForTimeInterval:2]; -// NSArray *vstEventArray = [MockEventQueue eventsFor:@"VISIT"]; -// //NSLog(@"VST事件:%@",vstEventArray); -// if (vstEventArray.count>0) -// { -// NSDictionary *vstchr=[NoburPoMeaProCheck VstEventCheck:[vstEventArray objectAtIndex:vstEventArray.count-1]]; -// //NSLog(@"Check Result:%@",vstchr); -// //判断检测结果,目前无地理位置请求 -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"chres"],@"Failed"); -// NSArray *empty=vstchr[@"KeysCheck"][@"EmptyKeys"]; -// XCTAssertEqual(empty.count, 1); -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"EmptyKeys"][0],@"ui"); -// -// NSArray *incr=vstchr[@"ProCheck"][@"incre"]; -// NSArray *redu=vstchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(incr.count, 0); -// XCTAssertEqual(redu.count, 2); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][0],@"latitude"); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][1],@"longitude"); -// NSLog(@"冷启动App,Vst事件检测,测试通过---Passed!"); -// } -// else -// { -// NSLog(@"冷启动App,Vst事件检测,测试不通过:%@!",vstEventArray); -// XCTAssertEqual(1, 0); -// } -// -//} - - -//-(void)test4BackGroundToBefore{ -// /* -// function:后台停留30s,再唤醒到前台 -// */ -// @try { -// [system deactivateAppForDuration:30]; -// } @catch (NSException *exception) { -// NSLog(@"从后台启动app,异常处理!"); -// CGPoint point=CGPointMake(32.0f, 14.0f); -// [tester tapScreenAtPoint:point]; -// } @finally { -// NSLog(@"*****This is the end!******"); -// } -// -// [tester waitForTimeInterval:2]; -// NSArray *vstEventArray = [MockEventQueue eventsFor:@"VISIT"]; -// //NSLog(@"VST事件:%@",vstEventArray); -// if (vstEventArray.count>1) -// { -// NSDictionary *vstchr=[NoburPoMeaProCheck VstEventCheck:[vstEventArray objectAtIndex:vstEventArray.count-1]]; -// //NSLog(@"Check Result:%@",vstchr); -// //判断检测结果,目前无地理位置请求 -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"chres"],@"Failed"); -// NSArray *empty=vstchr[@"KeysCheck"][@"EmptyKeys"]; -// XCTAssertEqual(empty.count, 1); -// XCTAssertEqualObjects(vstchr[@"KeysCheck"][@"EmptyKeys"][0],@"ui"); -// -// NSArray *incr=vstchr[@"ProCheck"][@"incre"]; -// NSArray *redu=vstchr[@"ProCheck"][@"reduce"]; -// XCTAssertEqual(incr.count, 0); -// XCTAssertEqual(redu.count, 2); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][0],@"latitude"); -// XCTAssertEqualObjects(vstchr[@"ProCheck"][@"reduce"][1],@"longitude"); -// NSLog(@"后台停留30s,再唤醒到前台,测试通过--Passed!"); -// } -// else -// { -// NSLog(@"后台停留30s,再唤醒到前台,测试不通过:%@",vstEventArray); -// XCTAssertEqual(1, 0); -// } -// -// -//} -// -//-(void)test2UandSChange{ -// /* -// function:测试两次vst请求中,U和S字段的变化 -// */ -// @try { -// [system deactivateAppForDuration:30]; -// } @catch (NSException *exception) { -// NSLog(@"从后台启动app,异常处理!"); -// CGPoint point=CGPointMake(32.0f, 14.0f); -// [tester tapScreenAtPoint:point]; -// } @finally { -// NSLog(@"*****This is the end!******"); -// } -// -// [tester waitForTimeInterval:2]; -// NSArray *vstEventArray = [MockEventQueue eventsFor:@"VISIT"]; -// //NSLog(@"VST事件:%@",vstEventArray); -// if (vstEventArray.count>1) -// { -// NSDictionary *vstchrfirst=[vstEventArray objectAtIndex:0]; -// NSDictionary *vstchrsecond=[vstEventArray objectAtIndex:1]; -// XCTAssertEqualObjects(vstchrfirst[@"userId"], vstchrsecond[@"userId"]); -// XCTAssertNotEqualObjects(vstchrfirst[@"sessionId"], vstchrsecond[@"sessionId"]); -// NSLog(@"测试两次vst请求中,U和S字段的变化,测试通过---Passed!"); -// } -// else -// { -// NSLog(@"测试两次vst请求中,U和S字段的变化,测试不通过:%@",vstEventArray); -// XCTAssertEqual(1, 0); -// } -// -// -//} -@end diff --git a/Example/ExampleTests/protocol test and api test/pageEventsTest.m b/Example/ExampleTests/protocol test and api test/pageEventsTest.m deleted file mode 100644 index 538fa26bf..000000000 --- a/Example/ExampleTests/protocol test and api test/pageEventsTest.m +++ /dev/null @@ -1,117 +0,0 @@ -// -// PageEventsTest.m -// GIOAutoTests -// -// Created by GrowingIO on 31/03/2018. -// Copyright © 2018 GrowingIO. All rights reserved. -// - -#import -#import "MockEventQueue.h" -#import "GrowingTestHelper.h" - -static NSString *pageType = @"PAGE"; - -@interface PageEventsTest : KIFTestCase - -@end - -@implementation PageEventsTest - - -- (void)beforeEach { - -} - -- (void)afterEach { - -} - -//冷启动app && 第一次进入page 请求页面 -//- (void)test1NotRunningToActive { -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"page请求"] tap]; -// -// //虽然产生了page事件,但是并没有添加到 MockEventQueue 中,所以设置10s延时 -// [tester waitForTimeInterval:10]; -// NSArray *pageEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// NSInteger count = [self calculateEventsCountWithTitle:@"page 请求" fromEventsArray:pageEventArray]; -// XCTAssertEqual(count, 1); -// -// [[[[viewTester usingLabel:@"Previous"] usingTraits:UIAccessibilityTraitButton] usingAbsenceOfTraits:UIAccessibilityTraitKeyboardKey] tap]; -//} - -//app 退到后台, 重新启动后进入page页面 -//- (void)test2BackgroundToActive { -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"page请求"] tap]; -// //进入后台10秒 -// [GrowingTestHelper deactivateAppForDuration:10]; -// //从后台唤醒app -// [GrowingTestHelper reactivateApp]; -// -// [tester waitForTimeInterval:10]; -// NSArray *pageEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// NSInteger count = [self calculateEventsCountWithTitle:@"page 请求" fromEventsArray:pageEventArray]; -// //进入page请求页面时有1个page请求,进入后台再进入page页面还会有一个page请求 -// XCTAssertEqual(count, 2); -// -// [[[[viewTester usingLabel:@"Previous"] usingTraits:UIAccessibilityTraitButton] usingAbsenceOfTraits:UIAccessibilityTraitKeyboardKey] tap]; -//} - -//因TabBarController item切换发送 page 请求 -//- (void)test3TabBarControllerSelectNewItem { -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"UI界面"] tap]; -// -// NSArray *pageEventArray = [MockEventQueue eventsFor:@"PAGE"]; -// //检验page请求的tl是否合理 -// NSInteger count = [self calculateEventsCountWithTitle:@"UI 测试" fromEventsArray:pageEventArray]; -// -// XCTAssertEqual(count, 1); -//} - -//因UINavigationController 切换发送 page 请求 -//- (void)test4EnterNavController { -// [[viewTester usingLabel:@"协议/接口"] tap]; -// [[viewTester usingLabel:@"page请求"] tap]; -// [tester waitForTimeInterval:10]; -// [MockEventQueue cleanQueue]; -// -// [[viewTester usingLabel:@"进入测试"] tap]; -// [tester waitForTimeInterval:10]; -// NSUInteger pageEventCount = [[MockEventQueue eventsFor:@"PAGE"] count]; -// -// XCTAssertEqual(pageEventCount, 1); -//} - -//ContainerViewController 添加了两个子VC -//由 FirstViewController 切换到 SecondViewController -//- (void)test5SwitchToSecondViewController { -// [MockEventQueue cleanQueue]; -// [[viewTester usingLabel:@"第二页"] tap]; -// [tester waitForTimeInterval:10]; -// NSUInteger pageEventCount = [[MockEventQueue eventsFor:@"PAGE"] count]; -// XCTAssertEqual(pageEventCount, 1); -//} - -- (void)setUp { - [super setUp]; -} - -- (void)tearDown { - [super tearDown]; -} - -//统计 tl 为 title 的event个数 -- (NSInteger)calculateEventsCountWithTitle:(NSString *)title fromEventsArray:(NSArray *)array { - NSInteger eventsCount = 0; - for (NSDictionary *dic in array) { - if ([dic[@"tl"] isEqualToString:title]) { - eventsCount += 1; - } - } - return eventsCount; -} - -@end diff --git a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEvent.m b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEvent.m index d7cc329b8..637d6909c 100644 --- a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEvent.m +++ b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEvent.m @@ -35,11 +35,11 @@ #import "UIViewController+GrowingPageHelper.h" @interface GrowingActionEvent () -@property (nonatomic, copy, readwrite) NSString *_Nullable query; +@property (nonatomic, copy, readwrite) NSString *_Nullable queryParameters; @property (nonatomic, copy, readwrite) NSString *_Nonnull pageName; @property (nonatomic, copy, readwrite) NSString *_Nullable name; @property (nonatomic, copy, readwrite) NSString *_Nullable objInfo; -@property (nonatomic, copy, readwrite) NSString *_Nullable pageTimestamp; +@property (nonatomic, copy, readwrite) NSString *_Nullable pageShowTimestamp; @property (nonatomic, strong) GrowingActionEventElement *element; @@ -109,7 +109,7 @@ - (_Nullable instancetype)initWithNode:(id)view element:(GrowingActionEventElement *)element { if (self = [super initWithTimestamp:nil]) { self.pageName = pageData[@"pageName"]; - self.pageTimestamp = pageData[@"pageShowTimestamp"]; + self.pageShowTimestamp = pageData[@"pageShowTimestamp"]; // 根据测量协议,点击事件的 p 字段需要拼接父级 p // https://growingio.atlassian.net/wiki/spaces/SDK/pages/1120830020/iOS+3.0 self.element = element; @@ -148,13 +148,13 @@ + (instancetype)hybridActionEventWithDataDict:(NSDictionary *)dataDict { GrowingActionEvent *actionEvent = [[self alloc] initWithTimestamp:timestamp]; actionEvent.pageName = dataDict[@"pageName"]; - actionEvent.query = dataDict[@"queryParameters"]; + actionEvent.queryParameters = dataDict[@"queryParameters"]; actionEvent.hybridDomain = dataDict[@"domain"]; GrowingActionEventElement *element = [[GrowingActionEventElement alloc] init]; element.hyperLink = dataDict[@"hyperlink"]; element.index = dataDict[@"index"]; - element.content = dataDict[@"textValue"]; + element.textValue = dataDict[@"textValue"]; element.xPath = dataDict[@"xpath"]; element.timestamp = dataDict[@"timestamp"]; @@ -199,10 +199,10 @@ - (NSDictionary *)toDictionary { if ([dataDictM valueForKey:@"eventSequenceId"]) { [dataDictM removeObjectForKey:@"eventSequenceId"]; } - if (self.pageTimestamp) { - dataDictM[@"pageShowTimestamp"] = self.pageTimestamp; + if (self.pageShowTimestamp) { + dataDictM[@"pageShowTimestamp"] = self.pageShowTimestamp; } - dataDictM[@"queryParameters"] = self.query; + dataDictM[@"queryParameters"] = self.queryParameters; dataDictM[@"pageName"] = self.pageName; dataDictM[@"domain"] = self.hybridDomain ?: self.domain; if (self.element) { diff --git a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.h b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.h index 2067d4809..672d72cca 100644 --- a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.h +++ b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.h @@ -17,8 +17,8 @@ // See the License for the specific language governing permissions and // limitations under the License. - #import + #import "GrowingEvent.h" #import "GrowingNodeProtocol.h" @@ -28,19 +28,16 @@ NS_ASSUME_NONNULL_BEGIN @interface GrowingActionEventElement : NSObject -@property (nonatomic, strong) NSNumber * _Nonnull globalSequenceId; -@property (nonatomic, strong) NSNumber * _Nonnull eventSequenceId; +@property (nonatomic, strong) NSNumber* _Nonnull globalSequenceId; +@property (nonatomic, strong) NSNumber* _Nonnull eventSequenceId; -@property (nonatomic, copy) NSString * _Nonnull xPath; -@property (nonatomic, copy) NSString * _Nullable hyperLink; -@property (nonatomic, copy) NSString * _Nullable index; -@property (nonatomic, copy) NSString * _Nullable cid; -@property (nonatomic, copy) NSString * _Nullable signature; -@property (nonatomic, strong) NSNumber * _Nonnull timestamp; -@property (nonatomic, copy) NSString * _Nullable content; +@property (nonatomic, copy) NSString* _Nonnull xPath; +@property (nonatomic, copy) NSString* _Nullable hyperLink; +@property (nonatomic, copy) NSString* _Nullable index; +@property (nonatomic, strong) NSNumber* _Nonnull timestamp; +@property (nonatomic, copy) NSString* _Nullable textValue; -- (instancetype)initWithNode:(id)node - triggerEventType:(GrowingEventType)eventType; +- (instancetype)initWithNode:(id)node triggerEventType:(GrowingEventType)eventType; @end NS_ASSUME_NONNULL_END diff --git a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.m b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.m index e9925fd1e..581ff0821 100644 --- a/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.m +++ b/GrowingAutoTracker/Event/GrowingActionEvent/GrowingActionEventElement.m @@ -17,31 +17,32 @@ // See the License for the specific language governing permissions and // limitations under the License. - #import "GrowingActionEventElement.h" -#import "GrowingNodeManager.h" -#import "UIViewController+GrowingNode.h" + #import "GrowingEventManager.h" -#import "NSString+GrowingHelper.h" -#import "UIView+GrowingHelper.h" #import "GrowingInstance.h" #import "GrowingNodeHelper.h" +#import "GrowingNodeManager.h" +#import "NSString+GrowingHelper.h" +#import "UIView+GrowingHelper.h" +#import "UIViewController+GrowingNode.h" @implementation GrowingActionEventElement -- (instancetype)initWithNode:(id)node - triggerEventType:(GrowingEventType)eventType { +- (instancetype)initWithNode:(id)node triggerEventType:(GrowingEventType)eventType { if (self = [super init]) { _xPath = [GrowingNodeHelper xPathForNode:node]; - _content = [self buildElementContentForNode:node]; + _textValue = [self buildElementContentForNode:node]; _timestamp = GROWGetTimestamp(); - _index = [NSString stringWithFormat:@"%d",(int)node.growingNodeKeyIndex]; - _cid = [node growingNodeUniqueTag]; + //对于非列表元素,不添加index字段 + if (node.growingNodeIndexPath) { + _index = [NSString stringWithFormat:@"%d", (int)node.growingNodeKeyIndex]; + } } return self; } -- (NSString *)buildElementContentForNode:(id _Nonnull)view { +- (NSString *)buildElementContentForNode:(id _Nonnull)view { NSString *content = [view growingNodeContent]; if (!content) { content = @""; @@ -52,19 +53,19 @@ - (NSString *)buildElementContentForNode:(id _Nonnull)view { } else { content = content.description; } - + if (![content isKindOfClass:NSString.class]) { content = @""; } - + content = [content growingHelper_safeSubStringWithLength:100]; - + if (content.growingHelper_isLegal) { content = @""; } else { content = content.growingHelper_encryptString; } - + return content; } @@ -72,15 +73,16 @@ - (NSDictionary *)toDictionary { NSMutableDictionary *dataDictM = [NSMutableDictionary dictionaryWithCapacity:5]; dataDictM[@"xpath"] = self.xPath; dataDictM[@"timestamp"] = self.timestamp; - dataDictM[@"cid"] = self.cid; - dataDictM[@"sgn"] = self.signature; - dataDictM[@"textValue"] = self.content; + if (self.textValue.length > 0) { + dataDictM[@"textValue"] = self.textValue; + } + dataDictM[@"hyperlink"] = self.hyperLink; dataDictM[@"index"] = self.index; dataDictM[@"globalSequenceId"] = self.globalSequenceId; dataDictM[@"eventSequenceId"] = self.eventSequenceId; - + return dataDictM; } diff --git a/GrowingAutoTracker/GrowingIMPTrack/GrowingIMPTrack.m b/GrowingAutoTracker/GrowingIMPTrack/GrowingIMPTrack.m index 2ebab3642..2f5ad77b1 100644 --- a/GrowingAutoTracker/GrowingIMPTrack/GrowingIMPTrack.m +++ b/GrowingAutoTracker/GrowingIMPTrack/GrowingIMPTrack.m @@ -18,14 +18,15 @@ // limitations under the License. #import "GrowingIMPTrack.h" + +#import "GrowingBroadcaster.h" #import "GrowingDispatchManager.h" -#import "UIView+GrowingNode.h" #import "UIApplication+GrowingNode.h" -#import "GrowingBroadcaster.h" +#import "UIView+GrowingNode.h" @GrowingBroadcasterRegister(GrowingViewControlerLifecycleMessage, GrowingIMPTrack) -@GrowingBroadcasterRegister(GrowingApplicationMessage, GrowingIMPTrack) -@interface GrowingIMPTrack() + @GrowingBroadcasterRegister(GrowingApplicationMessage, GrowingIMPTrack) + @interface GrowingIMPTrack() @property (nonatomic, strong) NSHashTable *sourceTable; @property (nonatomic, strong) NSHashTable *bgSourceTable; @@ -36,10 +37,10 @@ @interface GrowingIMPTrack() *node = obj; if (![node growingImpNodeIsVisible]) { node.growingIMPTracked = NO; @@ -103,7 +98,8 @@ - (void)markInvisibleNodes { }]; } -- (void)markInvisibleNode:(UIView *)node inSubView:(BOOL)flag; { +- (void)markInvisibleNode:(UIView *)node inSubView:(BOOL)flag; +{ if (node.growingIMPTrackEventName > 0) { node.growingIMPTracked = NO; } @@ -131,8 +127,7 @@ - (void)addWindowNodes { } } -- (void)enumerateSubViewsWithNode:(UIView *)node - block:(void (^)(UIView *view))block { +- (void)enumerateSubViewsWithNode:(UIView *)node block:(void (^)(UIView *view))block { if (!self.impTrackActive) { return; } @@ -155,12 +150,13 @@ + (instancetype)shareInstance { } - (instancetype)init { + if (impTrack != nil) { + return nil; + } - if (impTrack != nil) { return nil; } - - if (self =[super init]) { - self.sourceTable = [[NSHashTable alloc] initWithOptions:NSPointerFunctionsWeakMemory | - NSPointerFunctionsObjectPointerPersonality + if (self = [super init]) { + self.sourceTable = [[NSHashTable alloc] + initWithOptions:NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPointerPersonality capacity:100]; } return self; @@ -179,57 +175,59 @@ - (void)registerMainRunloopObserver { // ensure call in main thread [GrowingDispatchManager dispatchInMainThread:^{ static CFRunLoopObserverRef observer; - - if (observer) { return; } - + + if (observer) { + return; + } + CFRunLoopRef runLoop = CFRunLoopGetCurrent(); // before the run loop starts sleeping // before exiting a runloop run CFOptionFlags activities = (kCFRunLoopBeforeWaiting | kCFRunLoopExit); - + observer = CFRunLoopObserverCreateWithHandler( - NULL, // allocator - activities, // activities - YES, // repeats - INT_MAX - 1, // order after CA transaction commits - ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - if (self.IMPInterval == 0.0) { - [self impTrack]; - } else { - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(impTrack) - object:nil]; - [self performSelector:@selector(impTrack) - withObject:nil - afterDelay:self.IMPInterval - inModes:@[ NSRunLoopCommonModes ]]; - } - }); - + NULL, // allocator + activities, // activities + YES, // repeats + INT_MAX - 1, // order after CA transaction commits and before autoreleasepool + ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { + if (self.IMPInterval == 0.0) { + [self impTrack]; + } else { + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(impTrack) object:nil]; + [self performSelector:@selector(impTrack) + withObject:nil + afterDelay:self.IMPInterval + inModes:@[ NSRunLoopCommonModes ]]; + } + }); + CFRunLoopAddObserver(runLoop, observer, kCFRunLoopCommonModes); CFRelease(observer); }]; } - (void)impTrack { - if (isInResignSate) { return; } - - if (self.sourceTable.count == 0) { return; } - - [self.sourceTable.allObjects - enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, - BOOL *_Nonnull stop) { - UIView *node = obj; - if ([node growingImpNodeIsVisible]) { - if (node.growingIMPTracked == NO) { - if (node.growingIMPTrackEventName.length > 0) { - [self sendCstm:node]; - } + if (isInResignSate) { + return; + } + + if (self.sourceTable.count == 0) { + return; + } + + [self.sourceTable.allObjects enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) { + UIView *node = obj; + if ([node growingImpNodeIsVisible]) { + if (node.growingIMPTracked == NO) { + if (node.growingIMPTrackEventName.length > 0) { + [self sendCstm:node]; } - } else { - node.growingIMPTracked = NO; } - }]; + } else { + node.growingIMPTracked = NO; + } + }]; } - (void)sendCstm:(UIView *)node { @@ -248,28 +246,29 @@ - (void)sendCstm:(UIView *)node { node.growingIMPTrackVariable = impTrackVariable; } - if (node.growingIMPTrackEventName.length > 0 && - node.growingIMPTrackVariable.count > 0) { - [Growing trackCustomEvent:node.growingIMPTrackEventName - withAttributes:node.growingIMPTrackVariable]; + if (node.growingIMPTrackEventName.length > 0 && node.growingIMPTrackVariable.count > 0) { + [Growing trackCustomEvent:node.growingIMPTrackEventName withAttributes:node.growingIMPTrackVariable]; } else if (node.growingIMPTrackEventName.length > 0) { [Growing trackCustomEvent:node.growingIMPTrackEventName]; } } -- (void)addNode:(UIView *)node inSubView:(BOOL)flag; { +- (void)addNode:(UIView *)node inSubView:(BOOL)flag; +{ if (node.growingIMPTrackEventName.length > 0) { [self.sourceTable addObject:node]; } - if (!flag) { return; } - + if (!flag) { + return; + } + [self enumerateSubViewsWithNode:node block:^(UIView *view) { - if (view.growingIMPTrackEventName.length > 0) { - [self.sourceTable addObject:view]; - } - }]; + if (view.growingIMPTrackEventName.length > 0) { + [self.sourceTable addObject:view]; + } + }]; } - (void)addNode:(UIView *)node { diff --git a/GrowingTracker/Event/GrowingCustomField.m b/GrowingTracker/Event/GrowingCustomField.m index 22badcd4b..a45826063 100644 --- a/GrowingTracker/Event/GrowingCustomField.m +++ b/GrowingTracker/Event/GrowingCustomField.m @@ -133,7 +133,7 @@ - (void)sendGIOFakePageEvent { if ([self isOnlyCoreKit]) { GrowingPageEvent *eventPage = [[GrowingPageEvent alloc] initWithTitle:@"" pageName:@"GIOFakePage" - referalPage:nil]; + referralPage:nil]; [GrowingEventManager shareInstance].lastPageEvent = eventPage; diff --git a/GrowingTracker/Event/GrowingEvent.h b/GrowingTracker/Event/GrowingEvent.h index 7b71e6d34..44865ccdd 100644 --- a/GrowingTracker/Event/GrowingEvent.h +++ b/GrowingTracker/Event/GrowingEvent.h @@ -33,6 +33,8 @@ static NSString *_Nonnull const kEventTypeKeyClick = @"VIEW_CLICK"; static NSString *_Nonnull const kEventTypeKeyInputChange = @"VIEW_CHANGE"; static NSString *_Nonnull const kEventTypeKeyInputSubmit = @"FORM_SUBMIT"; + + // event类型定义 #define GROWING_EVENT_LIST(MACRO) \ MACRO(AppLifeCycleAppNewVisit, = 1, @"一次新访问") \ diff --git a/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.h b/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.h index 0e849422d..03dff3e71 100644 --- a/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.h +++ b/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.h @@ -25,16 +25,16 @@ NS_ASSUME_NONNULL_BEGIN @interface GrowingPageEvent : GrowingEvent @property (nonatomic, copy, readonly) NSString * _Nullable pageTitle; -@property (nonatomic, copy, readonly) NSString * _Nullable referalPage; +@property (nonatomic, copy, readonly) NSString * _Nullable referralPage; @property (nonatomic, copy, readonly) NSString * _Nullable pageName; @property (nonatomic, copy, readonly) NSString * _Nullable orientation; @property (nonatomic, copy, readonly) NSString * _Nullable networkState; + (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName timestamp:(NSNumber *)timestamp; -+ (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName referalPage:(NSString * _Nullable)referalPage; ++ (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName referralPage:(NSString * _Nullable)referralPage; -- (instancetype)initWithTitle:(NSString *)title pageName:(NSString *)pageName referalPage:(NSString * _Nullable )referalPage; +- (instancetype)initWithTitle:(NSString *)title pageName:(NSString *)pageName referralPage:(NSString * _Nullable )referralPage; + (instancetype)hybridPageEventWithDataDict:(NSDictionary *)dataDict; diff --git a/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.m b/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.m index e8e2f6d8d..62fe24642 100644 --- a/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.m +++ b/GrowingTracker/Event/GrowingPageEvent/GrowingPageEvent.m @@ -27,7 +27,7 @@ @interface GrowingPageEvent () @property (nonatomic, copy, readwrite) NSString * _Nullable orientation; @property (nonatomic, copy, readwrite) NSString * _Nullable pageTitle; -@property (nonatomic, copy, readwrite) NSString * _Nullable referalPage; +@property (nonatomic, copy, readwrite) NSString * _Nullable referralPage; @property (nonatomic, copy, readwrite) NSString * _Nullable pageName; @property (nonatomic, copy, readwrite) NSString * _Nullable networkState; @@ -41,24 +41,24 @@ @interface GrowingPageEvent () @implementation GrowingPageEvent -- (instancetype)initWithTitle:(NSString *)title pageName:(NSString *)pageName referalPage:(NSString *)referalPage { +- (instancetype)initWithTitle:(NSString *)title pageName:(NSString *)pageName referralPage:(NSString *)referralPage { if (self = [super initWithTimestamp:nil]) { self.pageTitle = title; self.pageName = pageName; - self.referalPage = referalPage; + self.referralPage = referralPage; self.networkState = [[GrowingNetworkInterfaceManager sharedInstance] networkType]; self.orientation = [GrowingDeviceInfo deviceOrientation]; } return self; } -+ (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName referalPage:(NSString *)referalPage { - return [[self alloc] initWithTitle:title pageName:pageName referalPage:referalPage]; ++ (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName referralPage:(NSString *)referralPage { + return [[self alloc] initWithTitle:title pageName:pageName referralPage:referralPage]; } + (instancetype)hybridPageEventWithDataDict:(NSDictionary *)dataDict { - NSString *referalPage = dataDict[@"referralPage"]; + NSString *referralPage = dataDict[@"referralPage"]; NSString *title = dataDict[@"title"]; NSString *pageName = dataDict[@"pageName"]; NSString *query = dataDict[@"queryParameters"]; @@ -66,7 +66,7 @@ + (instancetype)hybridPageEventWithDataDict:(NSDictionary *)dataDict { GrowingPageEvent *page = [[self alloc] initWithTitle:title pageName:pageName - referalPage:referalPage]; + referralPage:referralPage]; page.timestamp = timestamp; page.query = query; @@ -74,7 +74,7 @@ + (instancetype)hybridPageEventWithDataDict:(NSDictionary *)dataDict { } + (instancetype)pageEventWithTitle:(NSString *)title pageName:(NSString *)pageName timestamp:(NSNumber *)timestamp { - GrowingPageEvent *page = [[self alloc] initWithTitle:title pageName:pageName referalPage:nil]; + GrowingPageEvent *page = [[self alloc] initWithTitle:title pageName:pageName referralPage:nil]; page.timestamp = timestamp; return page; } @@ -90,7 +90,7 @@ - (NSDictionary *)toDictionary { dataDictM[@"networkState"] = [[GrowingNetworkInterfaceManager sharedInstance] networkType]; dataDictM[@"domain"] = self.hybridDomain ?: self.domain; dataDictM[@"pageName"] = self.pageName; - dataDictM[@"referralPage"] = self.referalPage; + dataDictM[@"referralPage"] = self.referralPage; dataDictM[@"queryParameters"] = self.query; dataDictM[@"orientation"] = self.orientation; dataDictM[@"title"] = self.pageTitle; diff --git a/GrowingTracker/Event/GrowingVisitEvent.m b/GrowingTracker/Event/GrowingVisitEvent.m index 5f6c45bd6..b0c01b0f4 100644 --- a/GrowingTracker/Event/GrowingVisitEvent.m +++ b/GrowingTracker/Event/GrowingVisitEvent.m @@ -31,8 +31,8 @@ @interface GrowingVisitEvent () @property (nonatomic, copy, readwrite) NSString *_Nonnull deviceModel; @property (nonatomic, strong, readwrite) NSNumber *_Nonnull isPhone; @property (nonatomic, copy, readwrite) NSString *_Nonnull deviceBrand; -@property (nonatomic, copy, readwrite) NSString *_Nonnull systemName; -@property (nonatomic, copy, readwrite) NSString *_Nonnull systemVersion; +@property (nonatomic, copy, readwrite) NSString *_Nonnull operatingSystem; +@property (nonatomic, copy, readwrite) NSString *_Nonnull operatingSystemVersion; @property (nonatomic, copy, readwrite) NSString *_Nonnull appName; @property (nonatomic, copy, readwrite) NSString *_Nonnull bundleID; @property (nonatomic, copy, readwrite) NSString *_Nonnull appShortVersion; @@ -63,8 +63,8 @@ - (instancetype)init { self.deviceModel = deviceInfo.deviceModel; self.isPhone = deviceInfo.isPhone; self.deviceBrand = deviceInfo.deviceBrand; - self.systemName = deviceInfo.systemName; - self.systemVersion = deviceInfo.systemVersion; + self.operatingSystem = deviceInfo.systemName; + self.operatingSystemVersion = deviceInfo.systemVersion; self.appName = deviceInfo.displayName; self.bundleID = deviceInfo.bundleID; self.appShortVersion = deviceInfo.appShortVersion; @@ -132,8 +132,8 @@ - (NSDictionary *)toDictionary { dataDictM[@"deviceModel"] = self.deviceModel; dataDictM[@"deviceType"] = self.isPhone.boolValue ? @"PHONE" : @"PAD"; dataDictM[@"deviceBrand"] = self.deviceBrand; - dataDictM[@"operatingSystem"] = self.systemName; - dataDictM[@"operatingSystemVersion"] = self.systemVersion; + dataDictM[@"operatingSystem"] = self.operatingSystem; + dataDictM[@"operatingSystemVersion"] = self.operatingSystemVersion; dataDictM[@"appName"] = self.appName; dataDictM[@"domain"] = self.bundleID; dataDictM[@"appVersion"] = self.appShortVersion; @@ -145,6 +145,7 @@ - (NSDictionary *)toDictionary { dataDictM[@"screenHeight"] = self.screenH; dataDictM[@"latitude"] = self.latitude; dataDictM[@"longitude"] = self.longitude; + //TODO: extraSdk字段在后续应该添加 return dataDictM; }