Like the official Java driver, the C# driver also derives its Query Language Tests from the official
rethinkdb\test\rql_test YAML tests.
The C# unit tests have been automatically converted from YAML to C# and reside inside:
You can simply run all the unit tests in
RethinkDb.Driver.Tests to test the driver's correctness.
Updating Generated Tests
The generated unit tests can be updated. The process for updating the auto-generated unit tests requires
convert_tests.py from the Java driver source. The following process updates the C# generated tests from YAML files:
Checkout the Java driver.
Ensure you have
java_term_info.json(if not read Getting Started on how to generate it).
Copy our special YAML
Test.yamltemplate to the Java driver's
template\Test.yamlfile (from our repo) should be alongside
template\Test.javafile in the Java driver folder.
Make two edits to
convert_test.pyto ensure the
Test.yamlfile is used when generating test outputs.
class TestFile(object): def render(self) .... self.renderer.render( 'Test.yaml', //EDIT 1: from Test.java output_dir=self.test_output_dir, output_name=self.module_name + '.yaml', //EDIT 2: from .java .... )
All we're doing here is using our template instead of the Test.java template to output the expected Java lines in ReQL.
python3 convert_tests.pyin the Java driver's folder. The result of the command will result in a batch of YAML files in
/src/test/java/gen/*.yamland overwrite all the YAML files in the C# driver's folder:
The fresh YAML files from the Java folder will be base64 encoded to keep non-ASCII characters intact and avoid complex character escape sequences when making the transition.
Next, clean up and decode the imported YAML tests by running
build yamlimporttask. The YAML tasks should now be valid YAML tests with correct escape sequences and character encodings.
build testgento regenerate the C# tests in
Source\RethinkDb.Driver.Tests\Generatedfrom the newly imported YAML files.