Can I test a project from outside the project?

Suppose I have a legacy rails or node-js or java project.
I will write a separate new project for tests. I will check all the tests pass.
Then I write a new elixir project and just change endpoint of test.
If all tests pass, I can finally switch.

years ago I have already done it before for a client… writing test in node-js and app was in Rails. It was possible because everything was through REST APIs.

Are there any advancements where I can be sitting in an Elixir project and test validations of Rails app? or test a completely another Elixir project?

It might be difficult to explain.
But think of directory structure like this.

  • A Backend app (API / GraphQL) build using Rails or Elixir
  • A test app built using Elixir
  • A frontend end that connects through REST or GraphQL
  • A Mobile app.

As of now I am thinking to build a GraphQL app and another project outside will test this GraphQL project without access to internals. Open to suggestions on how to keep test project Independent and outside main project.

This might not be the best solution but the trivial solution is

test "integration" do
  assert {_, 0} = System.cmd("mix", ["test"], cd: "/path/to/other/project")
end

Replace with test command for other languages as you see fit. Nicely, the elixir VM will be running and active while you run this test.

Don’t forget to increase the test timeout if the slow languages take more than 60s to test everything, especially in CI

1 Like