Test cases guidelines
EditHow to write a test case
What is a good test
- Small test, with only one goal.
- Independent test, a test does not relate to another one.
- Same test can be run multi-time.
- Every team can understand the test.
Which syntax to write a test
There is several ways to describe a test. We chose Gherkin syntax because it is a standard and it is well documented. With Gherkin a test looks like a scenario which describes a use case. These scenarios are useful for a better collaboration across all teams during the whole development of a feature.
The reference: https://cucumber.io/docs/gherkin/reference/
Scenario: Title of the test case
Given [Setup]
And [more context]
When [Action]
Then [Assertion]
And [more outcome]
Where add a test case
The dedicated feature test case is used for this purpose. A GitLab test case is similar to an issue we can add some metadata with label. These metadata will be useful for creating future test run by theme, feature, version with our tool.
Each test case has to include:
- GitLab test case title is equals to the Gherkin scenario title.
- Only one Gherkin scenario with the dedicated code highlight
gherkin. - (optional) Add technical help for the tester.
Example
Upload a file with chunk upload
Scenario: Upload a file with chunk upload
Given a Murena account is configured
When the user push a file greater than 3MB to "Documents"
Then edrive detects the file
And it uses the chunk upload
When the user switches off the network
Then edrive stops the upload due to network issue
And edrive pauses the upload
And the given file is not visible on Murena cloud
When edrive triggers the next sync
Then edrive continues the upload
And the file is fully uploaded on the Murena cloud
Help
Print edrive logs:
adb logcat --pid $(adb shell pidof -s foundation.e.drive)
Push a 150MB file to the device:
adb shell dd if=/dev/zero of=/storage/self/primary/Documents/test-file.qa bs=1 count=0 seek=150MB
Download the file from Murena cloud:
curl -X GET -u 'username@e.email:PASSWORD' https://murena.io/remote.php/dav/files/username@e.email/Documents/test-file.qa --output /tmp/test-file.qa
Tests facets
The test plan of any project should take into account the following facets:
- mobile - tablet - desktop
- light mode - dark mode
- new user - existing user (update, backward compatibility)
- arm32 - arm64 - x86
- portrait - landscape
- different languages
- online - offline
- accessibility, including scrolling
- single user - multiple user - pro-profile
- Behavior after a reboot (especially for services)