Skip to content
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

Dynamic code loading in generate-e2e-test.py tests #111

Open
jeremydouglass opened this issue Jun 12, 2017 · 1 comment
Open

Dynamic code loading in generate-e2e-test.py tests #111

jeremydouglass opened this issue Jun 12, 2017 · 1 comment

Comments

@jeremydouglass
Copy link
Member

jeremydouglass commented Jun 12, 2017

Currently each test created by hack/generate-e2e-test.py as found in #109 defines coreCodeTemplate as a String. That String is a copy of the contents of SomeExample.rpde + "\n\nsaveFrame(\"%s\")\nexit()\n".

If tests are going to live in the same repo as examples, then this is code duplication, which hurts maintainability.

In the future, tests extending E2eTestBase should not contain a copy of example code. Instead each test should include a Java statement that dynamically loads a specific .rpde example filename into a String, then appends saveFrame() and exit() to that string.

Loading at test time will prevent tests and examples from getting out of sync during testing if the example is being edited but the test isn't regenerated (so the coreCodeTemplate String is out-of-date).

@gaocegege
Copy link
Member

Yeah, that is the first idea when I tried to implement the test cases generation. But it is a little complex because of the path problem: They have different paths in different envs.

We need to use relative path and set the root path of the repo as the base path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants