How can I achieve data driven testing using csv file ?

Posted 6 days ago by Shekar

Post a topic
Answered
S
Shekar

How can I achieve data driven testing using csv file ?

0 Votes

T

TheBugScout posted 5 days ago Best Answer

Data Driven Testing Using a CSV File 


In Alchemy, you can achieve data-driven testing using three different methods: 


Using a CSV Data Source: CSV is useful when you have varying data sets that need to be tested with different inputs. It is particularly beneficial when you want to test the same functionality with multiple sets of data. 


Using Static Data: Static data sources are suitable for scenarios where test data is fixed and not expected to change often. Any changes to the test data require modifying the test scripts or code. The test data is written directly into the code and does not change unless the code is modified. 


Using Synthesized Data Sources: A synthesized data source refers to data that has been artificially created or generated for specific purposes, such as testing, training, or analysis, rather than being collected from real-world observations. This synthesized data aims to mimic real data in structure and content but is produced through various generation methods. It is especially useful when real data is limited or unavailable. 


Data Driven Testing Using the CSV Data Source: 

To perform data-driven testing using a CSV data source, follow these steps: 


1. Make sure you have a recorded test to which you want to make a DDT test, for demonstration I have recorded a login test as below. 

 


2. Now, go to the Data tab. 


3. Click on the "Create Data Source" button. A prompt will appear asking you to provide a name and browse for the CSV file. Provide a name for the data source, choose the type as CSV, browse for the file, and choose whether you want to ignore the first row/header or not. Note: If you don’t ignore the header by selecting the "Ignore Header" checkbox, your data source will be created with the header included as a data row. If you do select "Ignore Header," the header will be considered as the header and not as a data row and click on the create data source button.    


Note:- Browsing file at the point is optional you can either browse the file or you can do it later and proceed by simply clicking the create data source button.  


Option 1: If you browse for the file at this stage, you will be prompted to import the data(table) schema. 

You can either import all the schema or deselect the schemas you don’t want to import, in my case as I want Email and Password, I will keep both checkboxes selected and will import schema 


 

 Option 2: If you don’t browse for the file at the time of creating the data source, you will not get prompted to import the data(table) schema, instead directly an empty data source will get created. 


so, in this case, you can now import the file by clicking the Data Source Information icon. This will open the Data Source Information window where you can browse for and import the file. Note: Just importing the CSV file from the Data Source Information icon is not enough. You have to create the data table and its schema using the "Add Table" and "Add" buttons present, so your data source schema gets associated with schema you created. 


a. Click Data Source information icon. 

 


b. Browsing the file using the browse button. 


c. Adding table and its fields manually, using the add table and add button. 


------------------------------------------------------------------------------------------------------------------------ 

------------------------------------------------------------------------------------------------------------------------ 



5. Once you have created the CSV data source, save the suite. 


6. Now you can refer to the data headers in the test wherever required. You can do this either by dragging the data headers from the Data Toolbox in the Data section or by copying the pointer from the Data section and pasting it into the required steps. 


7. Loop this data over the test by clicking on the Test Information icon, locating the "Loop Data" dropdown, and choosing the name of the data table over which you want to loop your test. This table name should be the one from which you referenced the header in the test. 


This way, you can set up your test as a data-driven test. 


You can also watch the Data Driven Testing Video using the link:  Data Driven Testing 



Thanks!

0 Votes


3 Comments

Sorted by
T

TheBugScout posted 1 day ago

Note:--

When you set up the test as a Data-Driven Test (DDT) by referencing the data fields and looping over the table name as mentioned in the above Best Answer, and run it using the execute button in the Alchemy UI, it will only process the first row of data.


To execute the test with all rows of data, download the executable and run it through the command prompt using below command-

java -jar "suitename.jar".

(Replace "suitename" with the actual name of your suite, which matches the JAR file name.)


Also, the java -jar "suitename.jar" command only works if you're in the directory where the JAR file is located. Be sure to navigate to that directory in the command prompt before running the command.

0 Votes

T

TheBugScout posted 5 days ago

You can also watch a video on data-driven testing at the following link:


https://www.youtube.com/watch?v=fuOPwYbXKJw&list=PLf3HoOUP1qC2_b8rls9P4zIWyO8bWHDZE&index=2


Additionally, you can learn about data-driven testing using synthetic data by watching this video:


https://www.youtube.com/watch?v=i-yjD35-TD4&list=PLf3HoOUP1qC2_b8rls9P4zIWyO8bWHDZE&index=3

0 Votes

T

TheBugScout posted 5 days ago Answer

Data Driven Testing Using a CSV File 


In Alchemy, you can achieve data-driven testing using three different methods: 


Using a CSV Data Source: CSV is useful when you have varying data sets that need to be tested with different inputs. It is particularly beneficial when you want to test the same functionality with multiple sets of data. 


Using Static Data: Static data sources are suitable for scenarios where test data is fixed and not expected to change often. Any changes to the test data require modifying the test scripts or code. The test data is written directly into the code and does not change unless the code is modified. 


Using Synthesized Data Sources: A synthesized data source refers to data that has been artificially created or generated for specific purposes, such as testing, training, or analysis, rather than being collected from real-world observations. This synthesized data aims to mimic real data in structure and content but is produced through various generation methods. It is especially useful when real data is limited or unavailable. 


Data Driven Testing Using the CSV Data Source: 

To perform data-driven testing using a CSV data source, follow these steps: 


1. Make sure you have a recorded test to which you want to make a DDT test, for demonstration I have recorded a login test as below. 

 


2. Now, go to the Data tab. 


3. Click on the "Create Data Source" button. A prompt will appear asking you to provide a name and browse for the CSV file. Provide a name for the data source, choose the type as CSV, browse for the file, and choose whether you want to ignore the first row/header or not. Note: If you don’t ignore the header by selecting the "Ignore Header" checkbox, your data source will be created with the header included as a data row. If you do select "Ignore Header," the header will be considered as the header and not as a data row and click on the create data source button.    


Note:- Browsing file at the point is optional you can either browse the file or you can do it later and proceed by simply clicking the create data source button.  


Option 1: If you browse for the file at this stage, you will be prompted to import the data(table) schema. 

You can either import all the schema or deselect the schemas you don’t want to import, in my case as I want Email and Password, I will keep both checkboxes selected and will import schema 


 

 Option 2: If you don’t browse for the file at the time of creating the data source, you will not get prompted to import the data(table) schema, instead directly an empty data source will get created. 


so, in this case, you can now import the file by clicking the Data Source Information icon. This will open the Data Source Information window where you can browse for and import the file. Note: Just importing the CSV file from the Data Source Information icon is not enough. You have to create the data table and its schema using the "Add Table" and "Add" buttons present, so your data source schema gets associated with schema you created. 


a. Click Data Source information icon. 

 


b. Browsing the file using the browse button. 


c. Adding table and its fields manually, using the add table and add button. 


------------------------------------------------------------------------------------------------------------------------ 

------------------------------------------------------------------------------------------------------------------------ 



5. Once you have created the CSV data source, save the suite. 


6. Now you can refer to the data headers in the test wherever required. You can do this either by dragging the data headers from the Data Toolbox in the Data section or by copying the pointer from the Data section and pasting it into the required steps. 


7. Loop this data over the test by clicking on the Test Information icon, locating the "Loop Data" dropdown, and choosing the name of the data table over which you want to loop your test. This table name should be the one from which you referenced the header in the test. 


This way, you can set up your test as a data-driven test. 


You can also watch the Data Driven Testing Video using the link:  Data Driven Testing 



Thanks!

0 Votes

Login or Sign up to post a comment

© Orasi Software, Inc. | All Rights Reserved.