1. Preface
    1. About MarathonITE
    2. Supported Platforms
      1. Java/Swing™
      2. Java/FX™
      3. Web Applications
    3. What's New in MarathonITE 5.0
    4. Change Log a.k.a Version History
    5. System Requirements
    6. Copyright Notice
  2. Getting Started
    1. Introduction to Test Automation
      1. Unattended Testing
      2. Semi Automated Testing
      3. Exploratory Testing
    2. MarathonITE Projects
    3. Your First Project
      1. Java/Swing™ Test Project
        1. Application Under Test - SwingSet3
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
      2. Java/FX™ Test Project
        1. Application Under Test - Ensemble
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
      3. Web Application Test Project
        1. Application Under Test - DuckDuckGo Search
        2. Creating a Project
        3. Recording a Test
        4. Anatomy of a Test Script
        5. Running Tests
        6. Looking at Results
    4. MarathonITE Sample Projects
  3. User Guide
    1. Installation and Startup
    2. MarathonITE User Interface
      1. Views
      2. Editors
      3. Output Views
    3. Creating Marathonite Test Projects
    4. Recording Tests
    5. Managing Checklists
    6. Exploratory Tests
    7. Semi Automated Tests
    8. Executing Tests
      1. Executing a Test from Editor
        1. Debugging Scripts
        2. Using Script Console
      2. Executing Tests from Test Runner
      3. Executing Tests in Batch Mode
    9. Organizing Tests
      1. Organizing Tests in Folder Heirarchy
      2. Organizing Tests as Features and Stories
      3. Organizing Tests in Suites
      4. Linking Tests to TMS and Issue Manager
    10. Modularizing Test Scripts
      1. Module Methods
      2. Extract Method Refactoring
      3. Using Data Loops
      4. Convert to Data Loop Refactoring
    11. Data Driven Tests
      1. Convert to DDT Refactoring
  4. Advanced Scripting
    1. Ruby Programming Language
    2. Marathon and Ruby
    3. Selenium/WebDriver Bindings
      1. Java/Swing™ Components
      2. Java/FX™ Controls

3.11.1.Convert to DDT Refactoring

Open the test case and open the Create Data Driven Test dialog by using «Refactor» ? «Create DDT…» command or toolbar button DDT Toolbar Button.

We will start with an example (recorded using SwingSet3 application):

#### Original Code

From the script we will extract string "John" using Create Data Driven Test dialog, as show below.

Extract Data Driven Test dialog

Select a line in Script Selection section from which you have to extract. All the Constants, which can be extracted will be shown in table-view Constants. You have to select corresponding checkbox(es) of the value column(s) to extract as parameter(s). You can also edit the name of the parameter in Extract with name column by double clicking on it.

All the extracted parameters are listed on Module Parameters section. Once extraction is done, press Convert button, it prompts for a file name to save it with. It create a CSV file with data(s) and save it in TestData folder.

#### Converted Code

The extract refactoring adds the call to use_data_file in the header. The file is expected to be in TestData folder. Note the $ prefix to variable names. These are global in nature.

Executing Data Driven Tests

There are mutiple ways of executing Data Driven Test. You can run the tests in regular way from Marathon as well as command line. Click on the play Play Button to run the test. Observe that the test runs once for the data row.

Managing Data

We can add more data to the CSV file. Edit the CSV file using CSV Editorand add few more rows. To open CSV Editor, doulbe click on a CSV file which is under TestData folder.

Marathon CSV Editor

Select a row from the table-view and copy the row using button Duplicate Row. Then edit columns to add data. The first column i.e marathontestname is appended to the test script name to create individual test names. Select a row and click button Remove Button to remove data from file.

Suggest Edit