Compound Steps: Uploading Data¶
These Steps are used to upload data to a URL. The specified URL's web service must be able to accept POST data.
Note:
-
Before uploading any data, the phone(s) must be connected to the internet via a WiFi or mobile data network.
-
Step Details where an upload should successfully finish need an Expectation Step to confirm the phone enters the expected state within the timeout.
-
Certain Step Details are incompatible with each other. If Incompatible Step Details are used, an exception will be printed to the log.
Start Upload ¶
This Step uploads a random amount of data to the URL. The colon (:
) written after the starts uploading
Step must be added in order to use Step Details.
Syntax
1 2 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
Example
1 | And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: |
This Step is eligible for:
-
Timed
-
Deferred
Stop the Upload ¶
These Step Details stop a data upload to a URL after a specified amount of time has passed or a certain amount of data has been uploaded.
Stop the Upload After a Specified Amount of Time ¶
This Step Detail stops a data upload after a specified amount of time.
The Expect the Upload to Finish Step should be used with this Step Detail.
Syntax
1 2 3 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: * it stops after <time Number> <timeUnits timeUnit> |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
Example
1 2 3 4 | And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it stops after 5 seconds And within 40 seconds, A expects upload MYUPLOAD to finish |
Stop the Upload After a Specified Amount of Data ¶
This Step Detail stops a data upload after a specified amount of data.
The Expect the Upload to Finish Step should be used with this Step Detail.
Syntax
1 2 3 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: * it stops after <volume Number> <dataUnits dataUnit> |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
-
volume - The number of data being uploaded
-
dataUnits - One of
byte
bytes
,kB
,MB
,GB
,KiB
,MiB
orGiB
Example
1 2 | And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it stops after 100 kB |
Stop the Upload After a Specified Amount of Data or Volume ¶
This Step Detail uses both the volume and time to stop a download.
The Expect the Upload to Finish Step should be used with these Step Details.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | Feature: UploadStep, check context Scenario: UploadStepContext Scenario Given a phone as A: * of type Android And deferred, within 30 seconds, A disables data connections And within 30 seconds, A enables data connections And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it stops after 5 seconds * it stops after 100 kB And within 40 seconds, A expects upload MYUPLOAD to finish |
In the example above, the upload will stop once either 5
seconds have passed or 100
kB have been uploaded.
Note: The upload will stop when one condition evaluates to true, regardless of which one is reached first.
Interrupt Uploads ¶
This Step interrupts one or all uploads.
Syntax
1 2 3 4 | // Interrupts all running uploads <name Identifier> interrupts all running uploads // Interrupts a single upload <name Identifier> interrupts upload <dataName Identifier> |
Parameters
-
name - The name assigned to the phone uploading data
-
dataName - The name assigned to the data session
Example
1 2 | And B interrupts all running uploads And A interrupts MYUPLOAD |
This Step is eligible for:
-
Timed
-
Deferred
Disallow Reconnects ¶
This Step Detail ensures that no reconnect will be attempted.
Syntax
1 2 3 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: * it disallows reconnects |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
Example
1 2 | And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it disallows reconnects |
Allow a Specified Amount of Reconnects ¶
This Step Detail specifies an allowable amount of reconnects.
The Expect the Upload to Finish Step should be used with this Step Detail.
Syntax
1 2 3 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: * it allows <reconnects Number> reconnects |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
-
reconnects - The number of reconnects allowed
Example
1 2 3 4 | And A starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it allows 10 reconnects And within 240 seconds, A expects upload MYUPLOAD to finish |
Note: If the number of reconnects exceeds the allowed amount and the upload volume or time has not been met, the upload Step will fail.
Reconnect After Specified Time of Inactivity ¶
This Step Detail reconnects after intaQt detects a specified duration of inactivity.
Syntax
1 2 3 4 | <name Identifier> starts uploading random data to <url String> as <dataName Identifier>: * it reconnects when detecting <time Time> <time TimeUnits> of inactivity |
Parameters
-
name - The name assigned to the phone uploading data
-
url - The URL the data is being uploaded to
-
time - The number of time units
-
timeUnits - One of
second
,seconds
,minute
orminutes
Example
1 2 3 4 | And starts uploading random data to "http://testdata.qitasc.com/upload" as MYUPLOAD: * it reconnects when detecting 30 seconds of inactivity. And within 240 seconds, A expects upload MYUPLOAD to finish |