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

Convert test harness into a series of unit tests #23

Open
1ec5 opened this issue Jan 26, 2014 · 4 comments
Open

Convert test harness into a series of unit tests #23

1ec5 opened this issue Jan 26, 2014 · 4 comments

Comments

@1ec5
Copy link
Owner

1ec5 commented Jan 26, 2014

Debug builds of AVIM have a built-in test harness that automatically types and verifies all the words in an input file (such as the FVDP corpus) in various configurations. The test harness made for an interesting demonstration years ago, but these days it makes much more sense to run unit tests on the command line, without Firefox running.

Before we can get conventional unit tests up and running, we should factor out the core input method engine #20 to remove the dependency on the DOM. The unit tests should be run via Spidermonkey or, failing that, some other JavaScript command line tool like node.

1ec5 added a commit that referenced this issue Aug 25, 2014
Whipped up a new test harness based on SpiderMonkey. Intended for testing transformer.js; something similar to the existing test harness is still required to ensure that browser integration works.

So far there aren’t really any tests, just a harness.

#23
@1ec5
Copy link
Owner Author

1ec5 commented Aug 25, 2014

  • Build test harness
  • Load FVDP tests
  • Devise tests for past bugs and regressions
  • Devise tests for bugs filed against other IMEs
  • Remove old UI-based test harness
  • Unit tests for ckSpell()
  • Fuzzing?

@1ec5
Copy link
Owner Author

1ec5 commented Apr 10, 2015

Travis now runs all the unit tests, including the entire FVDP corpus, on each push. These tests only exercise the transformer; we’re lacking coverage of the overlay and frame scripts. To test those, we’ll need some way of installing the extension into Firefox via the command line, and we’ll need some way to send keypress events to Firefox (headless testing?).

@kimkha
Copy link

kimkha commented Apr 14, 2015

I found Browserify can simulate a browser in command line: http://www.rexfeng.com/blog/2014/07/how-to-unit-test-your-js-and-use-it-in-the-browser/

Hope this help

@1ec5
Copy link
Owner Author

1ec5 commented Apr 14, 2015

Thanks for the tip. Browserify is good for automated testing of a webpage in a browser environment. Travis already tests the only script that can be embedded in a webpage – transformer.js – in the exact same JavaScript environment as Firefox. What I'm mainly interested in is ensuring that the non-webpage parts – the extension itself – get testing.

Now that I've removed the old test harness from the bootstrapped branch, the outstanding task is to get Travis to run its built-in headless Firefox installation with a profile that includes AVIM. Perhaps node.js would be handy for processing a Web form that accepts input from this headless Firefox and relays it to the test harness.

The main benefit of such a setup would be that we would know immediately when Firefox removes a low-level API (#125) or a WYSIWYG editor library like Ace changes its API. Unfortunately, the most fragile part of AVIM historically has been support for Web apps like Google Docs and iCloud, where we rely on internal routines or IDs that could change without notice. These apps require accounts; I suspect it might not be kosher to set up an iCloud account essentially for automated testing of itself.

This was referenced Apr 15, 2015
@1ec5 1ec5 mentioned this issue Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants