onnxruntime/tools/ci_build/github/azure-pipelines/templates
Caroline Zhu 4dbaa73738
[js/web/training] added end-to-end tests (#18700)
## Summary
* following inference's [set-up for end-to-end
tests](https://github.com/microsoft/onnxruntime/tree/main/js/web/test/e2e),
created an end-to-end test runner for training
* this test runner copies testdata from the [trainingapi
folder](https://github.com/microsoft/onnxruntime/tree/main/onnxruntime/test/testdata/training_api)
* then runs two tests (training session with evalModel & optimizer
model, and training session with the minimum options), and tests if the
ORT-web training package encompasses inference
  * these tests check 
    * createTrainingSession
    * runTrainStep
    * runOptimizerStep if applicable
* the parameters methods (getParametersSize, loadParametersBuffer, and
getContiguousParameters)

## TL;DR
*
[`js/web/test/training/e2e/run.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-c1359c4d401f9ba69e937814219cefe5fd11b151a6ffd084c641af3c82e8216c)
is responsible for setting up and running the end to end tests
*
[`js/web/test/training/e2e/common.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-ee5452491b7b2563d175d13d81d10f2323b12b18589aa4c5798962a8b904a4a8)
contains the test function definitions (`testInferenceFunction`,
`testTrainingFunctionMin`, `testTrainingFunctionAll`)

## Flow
* entrypoint: user runs the following command in the terminal: `npm run
test:training:e2e`
*
[`js/web/package.json`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-79275844e75c3c410bb3a71c7f59b2b633e5a3e975c804ffc47220025084da28)
was modified to include an npm script that will run `run.js` which will
run the end to end tests
*
[`js/web/test/training/e2e/run.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-c1359c4d401f9ba69e937814219cefe5fd11b151a6ffd084c641af3c82e8216c)
is responsible for
  * detecting and installing local tarball packages of ORT-web
  * copying training data to the `js/web/training/e2e/data` folder
* starting two Karma processes. Karma is a test runner framework that
simulates testing in the browser.
* In this case, the tests happen in Chrome. We can configure the tests
to run in Edge and other browsers in the future.
* one of these karma processes is self-hosted, meaning it pulls the
ORT-web package from local
* the other karma process is not self-hosted, meaning it pulls the
ORT-web package from another source. In this case, we start an http
server that serves the ORT-web binaries.
*
[`js/web/test/training/e2e/simple-http-server.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-f798ab485f3ec26c299fe5b2923574c9e4b090200ba20d490bbf6c183286993c)
is responsible for starting the HTTP server and serving the ORT binary
files. This code almost identical to the same code in the inference E2E
tests.
*
[`js/web/test/training/e2e/karma.conf.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-436cfe8f670c768a04895bd4a1874a5e033f85e0e2d84941c62ff1f7c30a9f28)
Karma configuration file that specifies what happens when a karma
process is started. The config specifies Mocha as the testing framework,
which will go through all the loaded files and run any tests that exist
*
[`js/web/test/training/e2e/browser-test-wasm.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-13b6155e106dddc7b531ef671186e69b2aadb8a0f4b2f3001db0991567d78221)
File that contains the tests that Mocha will pick up on and run.
* The test functions (such as testInference and testTrainingFunctionAll)
are defined in
[`js/web/test/training/e2e/common.js`](https://github.com/microsoft/onnxruntime/compare/main...carzh:onnxruntime:carzh/training-e2e-runner?expand=1#diff-ee5452491b7b2563d175d13d81d10f2323b12b18589aa4c5798962a8b904a4a8).

## Notes
* I followed the [tests for training
core](b023de0bfc/orttraining/orttraining/test/training_api/core/training_api_tests.cc)
where they randomly generated input for the training session
* E2E tests are triggered by running `npm run test:training:e2e` --
suggestions for alternative script names are appreciated!!!

## Motivation and Context
- adding training bindings for web
2024-01-12 13:33:33 -08:00
..
jobs Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
stages Enable MacOS build in ORT Objc Pod (#18786) 2023-12-13 13:50:42 -08:00
android-binary-size-check-stage.yml
android-dump-logs-from-steps.yml
android-java-api-aar-test.yml Attempt to make the usage of the Android emulator in CIs more robust (#17903) 2023-10-15 08:42:36 +10:00
android-java-api-aar.yml
build-linux-wasm-step.yml Always run emsdk_env.sh before build.py, even when ccache is disabled (#18477) 2023-11-16 21:37:29 -08:00
c-api-artifacts-package-and-publish-steps-posix.yml
c-api-artifacts-package-and-publish-steps-windows.yml Add cuda context headers to zip (#18330) 2023-11-09 14:53:58 -08:00
c-api-cpu.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
c-api-linux-cpu.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
check-cache-stats.yml
clean-agent-build-directory-step.yml
common-variables.yml
compliance.yml
component-governance-component-detection-steps.yml
download-deps.yml Update absl and googletest (#18827) 2023-12-14 16:15:07 -08:00
esrp_nuget.yml
explicitly-defined-final-tasks.yml
final-jar-testing.yml Reduce downloads in Nuget-Java pipeline to reduce connection exception (#18635) 2023-12-01 07:44:44 +08:00
flex-downloadPipelineArtifact.yml
get-docker-image-steps.yml
install-appcenter.yml
java-api-artifacts-package-and-publish-steps-posix.yml
linux-build-step-with-cache.yml
linux-ci.yml
linux-cpu-packaging-pipeline.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
linux-gpu-tensorrt-packaging-pipeline.yml Create a new Nuget Package pipeline for CUDA 12 (#18135) 2023-11-28 09:03:46 -08:00
linux-wasm-ci.yml Remove EnvSetupScript parameter from win-ci.yml (#18662) 2023-12-01 15:30:16 -08:00
linux-web-init-and-check.yml [js/web] fix typescript type check (#18343) 2023-11-10 16:03:38 -08:00
mac-build-step-with-cache.yml
mac-cpu-packaging-pipeline.yml
mac-cpu-packaging-steps.yml
mac-cpu-packing-jobs.yml Update min macos version (#18251) 2023-11-10 11:08:17 -08:00
mac-esrp-dylib.yml
nodejs-artifacts-package-and-publish-steps-posix.yml
nodejs-artifacts-package-and-publish-steps-windows.yml
ondevice-training-cpu-packaging-pipeline.yml Remove EnvSetupScript parameter from win-ci.yml (#18662) 2023-12-01 15:30:16 -08:00
orttraining-linux-gpu-test-ci-pipeline.yml
py-linux-gpu.yml Create a new Python Package pipeline for CUDA 12 (#18348) 2023-11-20 09:48:28 -08:00
py-linux.yml Remove Windows ARM32 from nuget packaging pipelines (#19049) 2024-01-09 07:45:03 -08:00
py-package-smoking-test.yml Adding python3.12 support to ORT (#18814) 2024-01-11 08:34:28 -08:00
py-packaging-linux-test-cpu.yml
py-packaging-linux-test-cuda.yml Change cuda image for tensorRT to the one with cudnn8 (#18102) 2023-10-26 16:28:57 -07:00
py-packaging-selectable-stage.yml fix the Olive CI pipeline failure on Windows (#18464) 2023-11-28 11:42:39 -08:00
py-packaging-stage.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
py-packaging-training-cuda-stage.yml Adding python3.12 support to ORT (#18814) 2024-01-11 08:34:28 -08:00
py-win-gpu.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
react-native-ci.yml Add MacOS build to ORT C Pod (#18550) 2023-11-28 10:11:53 -08:00
rocm.yml [ROCm] add migraphx into onnxruntime-training-rocm package (#18339) 2023-11-14 11:54:22 +08:00
run-docker-build-steps.yml
set-nightly-build-option-variable-step.yml
set-python-manylinux-variables-step.yml Set pythonInterpreter in set-python-manylinux-variables-step.yml (#19105) 2024-01-12 07:22:02 -08:00
set-version-number-variables-step.yml
telemetry-steps.yml
upload-code-coverage-data.yml
use-android-emulator.yml Attempt to make the usage of the Android emulator in CIs more robust (#17903) 2023-10-15 08:42:36 +10:00
use-android-ndk.yml Update NDK version to 26.1.10909125 (#18493) 2023-11-17 14:14:01 -08:00
use-xcode-version.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
validate-package.yml
web-browserstack-ci.yml
web-ci.yml Update web-ci.yml: remove depth=1 (#18500) 2023-11-17 22:49:03 -08:00
win-ci.yml Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
win-esrp-dll.yml
win-wasm-ci.yml Remove XNNPack from web pipelines (#18419) 2023-11-13 22:43:53 -08:00
win-web-ci.yml [js/web/training] added end-to-end tests (#18700) 2024-01-12 13:33:33 -08:00
win-web-multi-browsers.yml
with-container-registry-steps.yml