Skip to content

Commit

Permalink
Update guide sequence (#125)
Browse files Browse the repository at this point in the history
* Add GuidanceConfiguration, drop shortened URLs

* Redesign AnalyticsTrasmitter and usage events

* Cleanup unused enum

* Fix: avoid sending duplicate 20 day event on upgrade

* Include Ide property in events

* Test: transmit Ide parameter

* Add tests for handling missing url in guidance step, refactoring

* Cleanup

* changelog
  • Loading branch information
tzongithub authored Mar 29, 2021
1 parent 545a25b commit 0e5a647
Show file tree
Hide file tree
Showing 25 changed files with 203 additions and 200 deletions.
4 changes: 3 additions & 1 deletion IdeIntegration/Analytics/Events/AnalyticsEventBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public abstract class AnalyticsEventBase : IAnalyticsEvent
{
protected AnalyticsEventBase(DateTime utcDate, string userId)
protected AnalyticsEventBase(string ide, DateTime utcDate, string userId)
{
Ide = ide;
UtcDate = utcDate;
UserId = userId;
}

public abstract string EventName { get; }
public string Ide { get; }
public DateTime UtcDate { get; }
public string UserId { get; }
}
Expand Down
19 changes: 0 additions & 19 deletions IdeIntegration/Analytics/Events/AnalyticsEventType.cs

This file was deleted.

4 changes: 3 additions & 1 deletion IdeIntegration/Analytics/Events/ExceptionAnalyticsEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ExceptionAnalyticsEvent : IAnalyticsEvent
{
public ExceptionAnalyticsEvent(string exceptionType, DateTime utcDate)
public ExceptionAnalyticsEvent(string ide, string exceptionType, DateTime utcDate)
{
Ide = ide;
ExceptionType = exceptionType;
UtcDate = utcDate;
UserId = null;
}

public string EventName => "Visual Studio Extension Exception";
public string Ide { get; }
public DateTime UtcDate { get; }
public string UserId { get; }
public string ExceptionType { get; set; }
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ExtensionInstalledAnalyticsEvent : AnalyticsEventBase
{
public ExtensionInstalledAnalyticsEvent(DateTime utcDate, string userId, string ideVersion, string extensionVersion) : base(utcDate, userId)
public ExtensionInstalledAnalyticsEvent(string ide, DateTime utcDate, string userId, string ideVersion, string extensionVersion) : base(ide, utcDate, userId)
{
IdeVersion = ideVersion;
ExtensionVersion = extensionVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ExtensionLoadedAnalyticsEvent : AnalyticsEventBase
{
public ExtensionLoadedAnalyticsEvent(DateTime utcDate, string userId, string ide, string ideVersion, string extensionVersion, IEnumerable<string> projectTargetFrameworks) : base(utcDate, userId)
public ExtensionLoadedAnalyticsEvent(string ide, DateTime utcDate, string userId, string ideVersion, string extensionVersion, IEnumerable<string> projectTargetFrameworks) : base(ide, utcDate, userId)
{
Ide = ide;
IdeVersion = ideVersion;
ExtensionVersion = extensionVersion;
ProjectTargetFrameworks = projectTargetFrameworks.ToArray();
}

public override string EventName => "Extension loaded";

public string Ide { get; }
public string IdeVersion { get; }
public string ExtensionVersion { get; }
public IReadOnlyList<string> ProjectTargetFrameworks { get; }
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ExtensionUpgradedAnalyticsEvent : AnalyticsEventBase
{
public ExtensionUpgradedAnalyticsEvent(DateTime utcDate, string userId, string oldExtensionVersion, string extensionVersion) : base(utcDate, userId)
public ExtensionUpgradedAnalyticsEvent(string ide, DateTime utcDate, string userId, string oldExtensionVersion, string extensionVersion) : base(ide, utcDate, userId)
{
OldExtensionVersion = oldExtensionVersion;
ExtensionVersion = extensionVersion;
Expand Down
16 changes: 16 additions & 0 deletions IdeIntegration/Analytics/Events/ExtensionUsageAnalyticsEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ExtensionUsageAnalyticsEvent : AnalyticsEventBase
{
private readonly int _daysUsage;

public ExtensionUsageAnalyticsEvent(string ide, DateTime utcDate, string userId, int daysUsage) : base(ide, utcDate, userId)
{
_daysUsage = daysUsage;
}

public override string EventName => $"{_daysUsage} day usage";
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System;
using EnumsNET;

namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ProjectTemplateWizardCompletedAnalyticsEvent : AnalyticsEventBase
{
public ProjectTemplateWizardCompletedAnalyticsEvent(DateTime utcDate, string userId, string selectedDotNetFramework, string selectedUnitTestFramework) : base(utcDate, userId)
public ProjectTemplateWizardCompletedAnalyticsEvent(string ide, DateTime utcDate, string userId, string selectedDotNetFramework, string selectedUnitTestFramework) : base(ide, utcDate, userId)
{
SelectedDotNetFramework = selectedDotNetFramework;
SelectedUnitTestFramework = selectedUnitTestFramework;
}

public override string EventName => AnalyticsEventType.ProjectTemplateWizardCompleted.AsString(EnumFormat.Description, EnumFormat.Name);
public override string EventName => "Project Template Wizard Completed";

public string SelectedUnitTestFramework { get; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using EnumsNET;

namespace TechTalk.SpecFlow.IdeIntegration.Analytics.Events
{
public class ProjectTemplateWizardStartedAnalyticsEvent : AnalyticsEventBase
{
public ProjectTemplateWizardStartedAnalyticsEvent(DateTime utcDate, string userId) : base(utcDate, userId)
public ProjectTemplateWizardStartedAnalyticsEvent(string ide, DateTime utcDate, string userId) : base(ide, utcDate, userId)
{
}

public override string EventName => AnalyticsEventType.ProjectTemplateWizardStarted.AsString(EnumFormat.Description, EnumFormat.Name);
public override string EventName => "Project Template Wizard Started";
}
}
1 change: 1 addition & 0 deletions IdeIntegration/Analytics/IAnalyticsEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace TechTalk.SpecFlow.IdeIntegration.Analytics
public interface IAnalyticsEvent
{
string EventName { get; }
string Ide { get; }
DateTime UtcDate { get; }
string UserId { get; }
}
Expand Down
31 changes: 31 additions & 0 deletions IdeIntegration/Install/GuidanceConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Collections.Generic;

namespace TechTalk.SpecFlow.IdeIntegration.Install
{
public class GuidanceConfiguration : IGuidanceConfiguration
{
public GuidanceConfiguration()
{

Installation = new GuidanceStep(GuidanceNotification.AfterInstall, null, @"https://specflow.org/welcome-to-specflow/");

Upgrade = new GuidanceStep(GuidanceNotification.Upgrade, null, @"https://specflow.org/welcome-to-specflow-visual-studio-integration-v2019-0/");

UsageSequence = new[]
{
new GuidanceStep(GuidanceNotification.TwoDayUsage, 2, "https://specflow.org/ide-onboarding-two-days/"),
new GuidanceStep(GuidanceNotification.FiveDayUsage, 5, "https://specflow.org/vs-onboarding-five-days/"),
new GuidanceStep(GuidanceNotification.TenDayUsage, 10, "https://specflow.org/beyond-the-basics/"),
new GuidanceStep(GuidanceNotification.TwentyDayUsage, 20, null),
new GuidanceStep(GuidanceNotification.HundredDayUsage, 100, "https://specflow.org/experienced/"),
new GuidanceStep(GuidanceNotification.TwoHundredDayUsage, 200, "https://specflow.org/veteran/")
};
}

public GuidanceStep Installation { get; }

public GuidanceStep Upgrade { get; }

public IEnumerable<GuidanceStep> UsageSequence { get; }
}
}
10 changes: 6 additions & 4 deletions IdeIntegration/Install/GuidanceNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ public enum GuidanceNotification
{
AfterInstall = 1,
Upgrade = 2,
FiveDayUser = 50,
AfterRampUp = 100,
Experienced = 200,
Veteran = 300
TwoDayUsage = 10,
FiveDayUsage = 50,
TenDayUsage = 75,
TwentyDayUsage = 100,
HundredDayUsage = 200,
TwoHundredDayUsage = 300
}
}
18 changes: 18 additions & 0 deletions IdeIntegration/Install/GuidanceStep.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace TechTalk.SpecFlow.IdeIntegration.Install
{
public class GuidanceStep
{
public GuidanceNotification UserLevel { get; }

public int? UsageDays { get; }

public string Url { get; }

public GuidanceStep(GuidanceNotification userLevel, int? usageDays, string url)
{
UserLevel = userLevel;
UsageDays = usageDays;
Url = url;
}
}
}
13 changes: 13 additions & 0 deletions IdeIntegration/Install/IGuidanceConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;

namespace TechTalk.SpecFlow.IdeIntegration.Install
{
public interface IGuidanceConfiguration
{
GuidanceStep Installation { get; }

GuidanceStep Upgrade { get; }

IEnumerable<GuidanceStep> UsageSequence { get; }
}
}
Loading

0 comments on commit 0e5a647

Please sign in to comment.