Update running tests documentation (#11257)

Update running library tests based on my new learnings.
This commit is contained in:
AdRiley 2024-10-24 10:26:30 +01:00 committed by GitHub
parent 908f426cac
commit 351597639f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -483,15 +483,53 @@ Running the tests for the JVM enso components is as simple as running
#### Testing Enso Libraries
To test the libraries that are shipped with Enso you need to first build the
engine, the easiest way to do so is to run `sbt buildEngineDistribution`. That
will create a distribution in the directory `built-distribution`. The engine
runner that can be used for running the tests is located at
`built-distribution/enso-engine-<VERSION>-linux-amd64/enso-<VERSION>/bin/enso`
(or `enso.bat` for Windows).
To run the tests inside sbt you can use the following command:
To run the tests you can run the following commands (where `enso` refers to the
built runner executable as explained above):
```sbt
sbt:enso> runEngineDistribution --run test/Table_Tests/
```
This builds the library code and runs all the tests in the specified folder. And
is the fastest way to build the code and run the tests.
Alternatively to run a single file of tests you can specify the file to run
```sbt
sbt:enso> runEngineDistribution --run test/Base_Tests/src/Data/Time/Duration_Spec.enso
```
Or you can pattern match against the test name using this syntax
```sbt
sbt:enso> runEngineDistribution --run test/Base_Tests/src/Data/Time/Duration_Spec.enso should.normalize
```
This runs all tests in Duration_Spec.enso that have 'should normalize' the their
name.
To run with a debugger first start the debugger listening on 5005, add a
breakpoint in a test then run with
```sbt
sbt:enso> runEngineDistribution --run test/Base_Tests --debug
```
The above running options also work when debugging.
Alternatively to run the test outisde of sbt you need to first build the engine,
the easiest way to do so is to run `sbt buildEngineDistributionNoIndex`. That
will create a distribution in the directory `built-distribution`. The engine
runner that can be used for running the tests is located at:
- on Windows
`built-distribution/enso-engine<VERSION>-windows-amd64/enso-<VERSION>/bin/enso.bat`
- on ARM mac -
`built-distribution/enso-engine-<VERSION>-macos-aarch64/enso-<VERSION>/bin/enso`
- on Linux -
`built-distribution/enso-engine-<VERSION>-linux-amd64/enso-<VERSION>/bin/enso`
you can run the following commands (where `enso` refers to the built runner
executable as explained above):
```bash
enso --run test/Base_Tests
@ -499,10 +537,17 @@ enso --run test/Geo_Tests
enso --run test/Table_Tests
```
Or to run just a single test (e.g., `Duration_Spec.enso`):
Or to run just a single test file (e.g., `Duration_Spec.enso`):
```bash
enso --in-project test/Base_Tests --run test/Base_Tests/src/Data/Time/Duration_Spec.enso
enso --run test/Base_Tests/src/Data/Time/Duration_Spec.enso
```
To run with a debugger first start the debugger listening on 5005, add a
breakpoint in a test then run with
```bash
JAVA_OPTS='-agentlib:jdwp=transport=dt_socket,server=n,address=5005' enso --run test/Base_Tests/src/Data/Time/Duration_Spec.enso
```
The Database tests will by default only test the SQLite backend, to test other