-
-
Notifications
You must be signed in to change notification settings - Fork 131
Unit Tests
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:
Source\RethinkDb.Driver.Tests\Generated
You can simply run all the unit tests in RethinkDb.Driver.Tests to test the driver's correctness.
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 above on how to generate it). -
Copy our special YAML
Test.yamltemplate to the Java driver'sjava\template\directory. Thetemplate\Test.yamlfile (from our repo) should be along sidetemplate\Test.javafile in the Java driver folder. -
Make two edits to
convert_test.pyto ensure theTest.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.
-
Next, run
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/*.yaml. -
Copy
/src/test/java/gen/*.yamland overwrite all the YAML files in the C# driver's folder:Source\Templates\UnitTests
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. -
Lastly, run
build testgento regenerate the C# tests inSource\RethinkDb.Driver.Tests\Generatedfrom the newly imported YAML files.
- Home
- Query Examples
- Logging
- Connections & Pooling
- Extra C# Features
- GOTCHA Goblins!
- LINQ to ReQL Provider
- Differences
- Java ReQL API Documentation