From 3fbb7325d36bcfedab567d6928d13c1a088d69f3 Mon Sep 17 00:00:00 2001 From: Sangith Ravichandran Date: Tue, 14 Feb 2023 11:17:51 +0530 Subject: [PATCH 1/2] Added examples and runtime variables --- .../test-cases/data-driven-testing.md | 84 +++++++++---------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/src/pages/tutorials/test-cases/data-driven-testing.md b/src/pages/tutorials/test-cases/data-driven-testing.md index c3413fe..da6cc1a 100644 --- a/src/pages/tutorials/test-cases/data-driven-testing.md +++ b/src/pages/tutorials/test-cases/data-driven-testing.md @@ -10,89 +10,87 @@ contextual_links: - type: section - name: "Contents" - type: link - name: "Prerequisites" - url: "#prerequisites" + name: "Enable Data-Driven in test case" + url: "#enable-data-driven-in-test-case" - type: link - name: "Step 1: Associate data profile with a test case" - url: "#step-1-associate-data-profile-with-a-test-case" + name: "Use parameter names in test case" + url: "#use-parameter-names-in-test-case" - type: link - name: "Step 2: Use parameter names in test case" - url: "#step-2-use-parameter-names-in-test-case" -- type: link - name: "Step 3: Run data driven test case" - url: "#step-3-run-data-driven-test-case" + name: "Run data driven test case" + url: "#run-data-driven-test-case" --- --- -Instead of hard-coding different values to test the same scenario with different test data, you can use Data Driven testing. In Testsigma, you can +This tutorial walks you through data-driven testing and how to enable it in the test case. This can involve using external test data profiles as a source within the project to drive its behaviour. The goal is to increase the effectiveness and efficiency of testing by automating repetitive tasks and ensuring comprehensive test coverage. In Testsigma, you can + -1. Import or read the test data and/or expected output data from external files or data sources, then +1. The test data and expected output data can be imported or read from external sources. -2. Feed this data into your automated test cases so that you don't need to hard-code the test data into the Test Steps definition. +2. Using this data, you can avoid hardcoding the test data into the Test Steps definition in your automated test cases. -The test steps iterates itself and subsequent rows of data are fed to the test steps as input. +Test steps iterate and feed subsequent rows of data into them as input. --- -> ## [Prerequisites:](#prerequisites) +### **Prerequisites** -> 1. You should know [how to create a test data profile](https://testsigma.com/docs/test-data/create-data-profiles/). -> 2. You should know [how to create a test case](https://testsigma.com/docs/test-cases/manage/add-edit-delete/). +You'll need to know how to create a [test cases](https://testsigma.com/docs/test-cases/manage/add-edit-delete/#creating-a-test-case), [test data profile](https://testsigma.com/docs/test-data/create-data-profiles/#create-a-test-data-profile), and [runtime variable](https://testsigma.com/docs/test-data/types/runtime/#how-to-use-runtime-test-data-in-test-steps). --- -## [Step 1: Associate data profile with your test case](#step-1-associate-data-profile-with-you-test-case) +## **Enable Data-Driven in test case** -1. In **Create** or **Edit** test case form and click on **Show additional options**. +1. On the **Create** or **Edit** test case page, click on **Show additional options** to unhide the features. +![unhide the feature](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/dd_showhideadvanced.png) -2. Select the **Test data profile** you want to add to your test cases and enable the toggle **Data Driven** as shown below: +2. Select the **Test data profile** from the drop-down menu and turn on the **Data driven** toggle. +![Toggle to enable data driven testing](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/dd_enabledd.png) -![Toggle to enable data driven testing](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/test_data_profile_associate.png) - -Enabling the data-driven toggle will enable the test to run multiple times based on the number of rows available in Test Data Profile. For. If the data profile has 5 rows(sets) the test will run 5 times automatically using each data set(row) everytime. +Enabling the data-driven toggle will allow the test to run multiple times based on the number of rows in the Test Data Profile. If the data profile has five rows (sets), the test will run five times automatically, using each data set (row) every time. [[info | Note:]] -| You can also select a specific data set if you want to run only once using data from a specific data set in the profile. - -If you enable the data driven testing in your test case you can narrow and customize the various data sets from your test data profile that are being used in your test case using the filters *iteration*, *parameter*, *set name*. +| You can also select a specific dataset if you want to run the profile only once, using data from that dataset. -* Iteration: This type of filtering is applicable only to sequential data sets. The data sets can be filtered using the filter operations greater than,less than, or between. +Data-driven testing allows you to narrow and customize your test case using filters like *iteration*, *set name*, and *parameter*. -* Set name: This type of filtering is applicable for non sequential data sets. Here the data sets are filtered by data set names using the operations between, equals, contains, starts with, ends with. Any data set names containing the set name or part of it are used in the test case. + * **Iteration:** This type of filtering applies only to sequential data sets. The data sets can be filtered using the filter operations *greater than*, *less than*, and *between*. -* Parameter:This type of filtering is applicable for non sequential data sets. Here the data sets are filtered using parameters used in data sets. + * **Set name:** This type of filtering applies to non-sequential data sets. Here, the data sets are filtered by their names using the operations *between*, *equals*, *contains*, *starts with*, and *ends with*. Any data set names containing the set name, or part of it are used in the test case. -![parameter](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/filter_test_case_list.png) + * **Parameter:** This type of filtering applies to non-sequential data sets. Here, the data sets are filtered using parameters used in the data sets. Here, filter operations are using *Equals*, *Contains*, *Start With*, *Ends With*, *Is Empty*, and *Is Not Empty*. -Refer to the below GIF on how to associate a test data profile to a test case -![test case data driven](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/create_data_driven_test_case.gif) +### +3. Click **Create** or **Update** once the data driven is enabled. +![test case data driven](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/create_data_driven_test_case.gif) ---- +[[info | NOTE:]] +| You can use **runtime variables** in **filter values** by entering **$|Maharashtra|**, where *Maharashtra* is a stored variable, as shown in the example above.   -## [Step 2: Use parameter names in test case](#step-2-use-parameter-names-in-test-case) -1. Back in your test cases, while creating test steps, click on *test data* and select *@|Parameter|* from the drop down as shown below: +--- -![Choose the test data parameter to use in your test step](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/select_parameter.png) +## **Use parameter names in test case** -2. Now an overlay will open with all available parameters in the data profile. +1. Click on **test data** and select **@|Parameter|** from the drop-down list when creating test steps in the test case.  +![Choose the test data parameter to use in your test step](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/dd_parametertestdata.png) -![Replace with parameter values](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/associate_parameter_name.png) +2. An overlay screen will open, displaying all available parameters in the test data profile. +![Replace with parameter values](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/dd_parameters.png) Now, your test case will use the parameter value from your test data profile. -Refer to the below GIF on how to use parameter names in test cases -![using parameter names in test case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/data-driven-testing/using_data_profile.gif) +![using parameter names in test case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/testdataparameter_dd.gif) --- -## [Step 3: Run Data Driven Test Case](#step-3-run-data-driven-test-case) +## **Run Data Driven Test Case** -1. Click on Run Now on the top right corner and select the test machine/device details - -2. Once the test run is complete you will get results for each of the data sets. Like in the screenshot below: +1. Click on **Run Now** in the top right corner, and the **Ad-hoc Run** screen will appear. Select the **test machine/device** and click **Run Now**. +2. Once the test run is complete you will get results for each of the data sets. ![run result status of your test dat sets](https://docs.testsigma.com/images/tutorials/data-driven-testing/run-status-test-data-profiles.png) + +--- \ No newline at end of file From 155d29b49c1d1d999c9da6567566917a3fc79f71 Mon Sep 17 00:00:00 2001 From: Sangith Ravichandran Date: Tue, 14 Feb 2023 15:09:36 +0530 Subject: [PATCH 2/2] Updated examples and gif --- src/pages/tutorials/test-cases/data-driven-testing.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/tutorials/test-cases/data-driven-testing.md b/src/pages/tutorials/test-cases/data-driven-testing.md index da6cc1a..68dec3d 100644 --- a/src/pages/tutorials/test-cases/data-driven-testing.md +++ b/src/pages/tutorials/test-cases/data-driven-testing.md @@ -64,11 +64,10 @@ Data-driven testing allows you to narrow and customize your test case using filt ### 3. Click **Create** or **Update** once the data driven is enabled. -![test case data driven](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/create_data_driven_test_case.gif) +![test case data driven](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/overview/dd_testcaseenable.gif) [[info | NOTE:]] -| You can use **runtime variables** in **filter values** by entering **$|Maharashtra|**, where *Maharashtra* is a stored variable, as shown in the example above.   - +| You can use **runtime variables** in **filter values** by entering **$|Washington, DC|**, where *Washington, DC* is a stored variable, as shown in the example above.   ---