-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Campaign testing approach #31
Comments
Exposing this method through Step is useful for unit testing segments without having to run the scheduler. cc #31
Hi @joshuap I've been thinking about testable workflows/funnels for a while now. While I don't have a solution in mind yet, it would be nice to have a way to make sure that our marketing funnels work as expected and ideally have a high-level overview of what the funnel looks like (how the different campaigns work together). Here's some pseudo-code: context "when the user first subscribes to our newsletter" do
it "receives the onboarding campaign"
context "when he clicks one of the three segmentation links" do
context "when the user clicks the 'beginner' link" do
it "receives campaign_A"
it "receives campaign_B"
end
context "when the user clicks the 'intermediate' link" do
it "receives campaign_C"
it "receives campaign_D"
end
context "when the user clicks the 'advanced' link" do
it "receives campaign_E"
it "receives campaign_F"
end
end
end
end |
Nice! I think these would be fairly simple to implement since you could basically test that the user is in the campaign, right? Something like: expect(
Heya::CampaignMembership.where(
user: user,
campaign_gid: OnboardingCampaign.gid
).exists?
).to eq(true) |
Well, sure, but I would do more of an integration test, like ensuring that the user receives the email it's supposed to receive. Now what I think it's most valuable here is to have a high-level overview of what your funnel looks like. So you can identify holes in it. I haven't tried it yet, but that's what I hope my tests can reveal. |
According to the Rails testing guide:
There likewise could be two aspects of testing Heya campaigns: unit and functional.
Unit Testing
I think I have a good approach for unit testing emails, using a similar API to Rails (this is currently working):
Functional Testing
Unlike ActionMailer, Hey campaign emails are sent from Heya's scheduler rather than arbitrary places like Rails controllers. It would be nice to be able to test that the correct emails are sent at the correct times, similar to how we do in the internal scheduler tests. Something along these lines (this is pseudo-code):
I'm not actually sure if this falls under functional testing or unit testing, since it's not really testing the integration between Heya and application components. In any case, I'm looking for feedback on it--would something like this be a good addition?
The text was updated successfully, but these errors were encountered: