Skip to content

wqian94/AuO-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AuO Test Suite version 1.0 (stable)

Corresponding AuO version: v1.0 (stable).

Using Selenium WebDriver version 2.53.0, Eclipse Jetty version 9.3.9, and Xvfb. Maven pom.xml included.

Suggested IDE is Eclipse Mars.2+ (4.5.2+).

Licensing

AuO and this testing suite are released under the MIT License. See the LICENSE file in the repositories for full license details.

Running tests

Dependencies

Since the testing suite relies on the Selenium WebDriver and Eclipse Jetty libraries, first run

mvn clean compile

to install those dependencies. The only dependencies that are not included are the Google Chrome browser binary and the Xvfb virtual screen emulator. The ChromeDriver for attaching the Google Chrome browser to Selenium WebDriver is included in the repository.

Screen emulation

The Xvfb binary is used to emulate a virtual screen for the browser to run on. This is mostly a matter of convenience, so that Google Chrome would not need to be repeatedly launched and closed in the main screen, and would instead be run on the Xvfb instance. Xvfb can be disabled by commenting out the corresponding lines during the build (see below on configuring via the client package's Web API).

Google Chrome binary

The ChromeDriver extension enables the ability to emulate on Google Chrome using Selenium WebDriver, but requires access to a Google Chrome binary. This can be configured via the client.Web API.

JUnit testing

Tests are written as JUnit tests, and are predominantly unit tests, with a few integration tests that have not been differentiated into separate test suites (something to be done in the future).

Unit test suites are written for each interface and sub-interface: the main UI, the title bar, the controls UI, the zoom UI, the audio UI, and the save UI. The name of the test suites begin with the camelCase name of the interface that it's testing, followed by the suffix Test. Each suite must be documented clearly with the testing strategy used by that suite in a block comment at the top of the test suite.

Server API

AuoServer

A mock server is implemented in the server package, with a main function included in AuoServer.java for running a standalone instance of the mock server. The server is constructed using the AuoServer's factory method, with the location of AuO.js as the first argument, and a port number to run the server on as the second argument. The recommend setting for the port is to pass in 0, which will run the server on a randomly-chosen open port.

Once the server is running, navigating to the server's /TEST URL will produce the test page, which is a fully-functional standalone instance of AuO. Saving to the /TEST-SAVE URL will not actually save the file, but the server will respond with a simple message, which is dictated by the class constant, AuoServer.SAVE_OK_RESPONSE. Both the /TEST and /TEST-SAVE URLs are case-sensitive.

The AuO.js file is also a special case. In order to facilitate faster loading, the file itself is cached in the memory of the server. If the file changes, the server will refresh its cache of the file. Additionally, the link to the file, /AuO.js, is case-insensitive, so /auo.js and /AUO.js will also target the file.

One final special case is the /STOP URL. Like the AuO.js file, this URL is case-insensitive, and signals for the server to terminate itself.

Log

The Log class in the server API provides simple logging functionality, and prints to System.err. The simplest call is Log.log(message, arguments...), where message is a formatted string, and arguments... is the variadic arguments to be passed in for formatting. This will print a log message to System.err with a timestamp on it. Labels can be prepended to the message by selecting a tag as the first argment, e.g. Log.log(Log.INFO, message, arguments...). Tags are represented by the enumerated values in the Log class.

Client API

Browser

The Browser enumerated class has the enumerated list of supported web browser versions. This is used in the Web and AuoServer classes to restrict the supported web browsers. As more browsers become supported, more options will be listed in the enumerated type.

Web

The Web class is responsible for setting up and launching the framework for the client itself. It includes both the configuration settings for the emulated environment and some convenience functions for use in testing.

Xvfb is configured and launched in the initiate function, with the target display set as a class constant. To disable Xvfb, comment out lines 47-56 (the initiation code) and lines 79-85 (the deconstruction code).

Chrome is configured in the getChromeDriver function. The display is set on line 213, so if Xvfb is disabled, then this line should also be commented out. The use-fake-ui-for-media-stream option automatically enables audio capture, so that the dialog box won't block using the MediaStream API. The remaining Chrome options should be self-explanatory.

The test and wait functions are used as syntactic sugar for waits while testing. The arguments are a WebDriver, a timeout (in seconds), and a function that takes in the driver as its sole argument. For test, this function must return a boolean -- whether to stop waiting. For wait, the function returns nothing. In Java 8+, this function can be written as a lambda function, which greatly simplifies the syntax for writing waits (see the test suites or Web.getDriver for some examples). Additionally, the polling frequency for both test and wait is set on line 100 to the frequency of one evaluation evey 100 milliseconds.

Test API

AbstractAuoTest

The AbstractAuoTest provides a setup and teardown framework for the tests. In particular, it deals with starting up a server on line 25, and provides the factory method getDriver() to produce a WebDriver to use. All packaged tests extend this class.

Under development

At the moment, Selenium WebDriver does not provide sufficient support for HTML5 Drag-and-Drop, so those tests are ignored at the moment. Once either WebDriver has support or a workaround is put in place these tests in AudioUITest.java should have its @Ignore tags removed.

Results

Build and test results are stored in the results/ subdirectory of this repository. Tests should be named in suite-browser-AuOv##-testsv## format, where suite is the name of the test suite used (or full-suite if all tests were run), browser is the name and version of the browser used, and the version numbers for AuO and this test suite should be filled in as well.

Development

AuO and this testing suite are currently developed and maintained by William Qian as part of his Master of Engineering thesis project with Daniel Wendel and Eric Klopfer in the MIT Scheller Teacher Education Program.

Bugs and issues should be reported in the GitHub issues page for AuO at https://github.com/wqian94/AuO/issues along with any helpful information that you can provide, such as operating system, browser (name and version), and any screenshots or videos that can help recreate the bug.