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

Add new web testing framework #22

Open
elizabethcarney opened this issue Jul 31, 2020 · 0 comments
Open

Add new web testing framework #22

elizabethcarney opened this issue Jul 31, 2020 · 0 comments

Comments

@elizabethcarney
Copy link

It would be awesome to add the new web testing stuff into the cookiecutter! The most important things to include are TestRunner.html, run_tests.sh, and a testing file stub.

A testing file stub could look a lot like this:

#include "../third-party/Empirical/source/web/Document.h"
#include "../third-party/Empirical/source/web/_MochaTestRunner.h"
struct ExampleTest : emp::web::BaseTest {
  int testValue;
  ExampleTest() { Setup(); }
  void Setup() {
    testValue = 2;
  }
  void Describe() override {
    EM_ASM({  
      const testValue = $0;
      describe("an example test", function() {
        it("should pass in a test value correctly", function() {
          chai.assert.equal(testValue, 2); 
        });
      });
    }, testValue);
  }
};
emp::web::MochaTestRunner test_runner;
int main() {
  emp::Initialize();
  test_runner.AddTest<ExampleTest>("ExampleTest");
  test_runner.Run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant