-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Isolate integration, external tests (#1156)
Signed-off-by: Dave Skender <[email protected]>
- Loading branch information
1 parent
0605107
commit 070a00e
Showing
46 changed files
with
625 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Indicators | ||
|
||
on: | ||
push: | ||
branches: ["main","v3"] | ||
|
||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test: | ||
name: integration tests | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
actions: read | ||
checks: write | ||
|
||
steps: | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
id: dotnet-new | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: "8.x" | ||
dotnet-quality: "ga" | ||
|
||
- name: Build library | ||
run: > | ||
dotnet build | ||
--configuration Release | ||
--property:ContinuousIntegrationBuild=true | ||
-warnAsError | ||
- name: Test integrations | ||
env: | ||
ALPACA_KEY: ${{ secrets.ALPACA_KEY }} | ||
ALPACA_SECRET: ${{ secrets.ALPACA_SECRET }} | ||
run: > | ||
dotnet test | ||
--configuration Release | ||
--settings tests/tests.integration.runsettings | ||
--results-directory ./test-results | ||
--no-build | ||
--verbosity normal | ||
--logger trx | ||
- name: Post test summary | ||
uses: dorny/test-reporter@v1 | ||
if: always() | ||
with: | ||
name: Test results | ||
path: ./test-results/**/*.trx | ||
reporter: dotnet-trx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Testing | ||
|
||
Tests are split into different projects for isolation of purpose. | ||
|
||
```bash | ||
# runs all unit | ||
# and integration tests | ||
dotnet test | ||
``` | ||
|
||
> When developing locally, we recommend that you normally _unload_ the external test projects shown below, except when testing externalities. | ||
## Unit tests | ||
|
||
> `indicators/Tests.Indicators.csproj` unit tests library | ||
Our primary full unit test project covers the entire utility of the library. In most IDE, you can [manually select](https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022#manually-select-the-run-settings-file) the `tests/tests.unit.runsettings` for isolation for local IDE dev/test efficiency, or use the _unload_ approach described above. | ||
|
||
```bash | ||
# CLI equivalent | ||
dotnet test --settings tests/tests.unit.runsettings | ||
``` | ||
|
||
## Performance tests | ||
|
||
> `tests/performance/Tests.Performance.csproj` benchmark tests | ||
Running the `Tests.Performance` console application in `Release` mode will produce [benchmark performance data](https://dotnet.stockindicators.dev/performance/) that we include on our documentation site. | ||
|
||
```bash | ||
# run all performance benchmarks (~15-20 minutes) | ||
dotnet run -c Release | ||
|
||
# run individual performance benchmark | ||
dotnet run -c Release --filter *.ToAdx | ||
|
||
# run cohorts of performance benchmarks | ||
dotnet run -c Release --filter ** | ||
``` | ||
|
||
```bash | ||
# to see all cohorts | ||
dotnet run --list | ||
... | ||
# Available Benchmarks: | ||
#0 Incrementals | ||
#1 SeriesIndicators | ||
#2 StreamExternal | ||
#3 StreamIndicators | ||
#4 Utility | ||
#5 UtilityMaths | ||
|
||
# to see all tests | ||
dotnet run --list flat | ||
``` | ||
|
||
## External tests | ||
|
||
All external integration and API tests can be run with one CLI | ||
|
||
```bash | ||
# CLI equivalent | ||
dotnet test --settings tests/tests.integration.runsettings | ||
``` | ||
|
||
Since we assume tests are non-integration tests by default, set the category attribute on any new test classes that contain integration tests. This can be applied uniquely to `[TestMethod]` as well. | ||
|
||
```csharp | ||
[TestClass, TestCategory("Integration")] | ||
public class MyIntegrationTests : TestBase | ||
... | ||
``` | ||
|
||
### Public API tests | ||
|
||
> `external/public-api/Tests.PublicApi.csproj` E2E libary external tests | ||
|
||
### Integration tests | ||
|
||
> `external/integration/Tests.Integration.csproj` connected to Live 3rd-party API |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.