- Simply use flutter test command.
- More to see https://flutter.dev/docs/cookbook/testing/unit/introduction
- Package test usage: https://pub.dev/packages/test
- An JS wrapper of dart unit test framework.
- Similar to jest framework usage.
- Support most jest framework apis:
describe
,it
,beforeEach
,afterEach
,beforeAll
,afterAll
. - Support async operation by return a promise object from
it
.
- We use flutter integration test to inject a running app.dart.
- Each js file in fixtures is a test case payload.
- Each case executed in serial.
- app_test.dart will drive app.dart to run the test.
- Compare detection screenshot content.
- More to see https://flutter.dev/docs/cookbook/testing/integration/introduction
The easist way is copy test case from wpt.
You also write test case script if wpt is not suitable.
- Create typescript file in
specs
folder. - Use describe and it to write test case like jasmine.
- Use
snapshot()
at the end ofit
to assert.
Tips:
- You can use
xit
to skip current test orfit
to focus current test. - Every snapshot file is stored at
snapshots
folder. Plases commit those file. - You can use
WEBF_TEST_FILTER
shell env to filter test to run. LikeWEBF_TEST_FILTER="foo" npm run integration
.
- intergration test: npm run test
Use the following commands to switch your GPU into Intel's integration GPU.
sudo pmset -a gpuswitch 0
- 0: Intel's GPU only
- 1: AMD GPU only
- 2: dynamic switch
this above command will execute which spec's name contains "synthesized-baseline-flexbox-001"
WEBF_TEST_FILTER="synthesized-baseline-flexbox-001" npm run integration