3. Exporting Data From Test Case To CSV File (XCTest)
During test case execution if you like to note down any element value or variable value for debugging purposes, then we can do that using the “Write to CSV” keyword.
-
- For example, here we are writing the value of the element “LastLocationStaticText” into the output CSV file in the first line.
- In the third line, we are writing the value of the variable “State” into the output CSV file.
- In the fourth line, we are writing the random string into the output CSV file for debugging.
- For example, here we are writing the value of the element “LastLocationStaticText” into the output CSV file in the first line.
-
- The output CSV file for the above is as follows:
- LastlocationStaticText, State, Log
- Last location, Texas, This is simple string
- The output CSV file for the above is as follows:
If we want to give an alias to the element or variable name that also we can do by adding it as the next parameter.
-
- The output CSV file for the above is as follows:
- Last Location Label, State Variable
- Last location, Texas
- The output CSV file for the above is as follows: