Skip to content

Better test setup #3

Description

@edisonywh

Before users adopt Frankenstein, they would already have a control code path, that is most likely already tested.

When they adopt Frankenstein, they most likely want to also test that if the candidate branch is ran instead, then their existing test should still pass.

Frankenstein right now has no ability to return candidate result; it always return control result, so this becomes impossible.

We can think about an API like

Frankenstein.adopt(fn ->
  do_something()
end)

where do_something/0 will hit a Frankenstein.run/1 that will instead return the candidate result. Potentially look into nimble_ownership for inspiration.

Alternatively, what would also be nice is the ability to automatically let users run two versions of tests. For example, proposed API

@frankenstein true
test "coconut" do
  do_something()
end

this tag, somehow making us compile two version of test on compile time, so the output will be:

# the OG control
test "coconut" do
  do_something()
end

# the candidate branch
test "(frankenstein) coconut" do
  Frankenstein.adopt(fn ->
    do_something() # this is the candidate branch
  end)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions