HomeHome
MarathonMarathon
MarathoniteMarathonite
CompanyCompany
ContactContact
WeblogWeblog
 

All things Marathon, Marathonite, Java and GUI Test automation, scripting and whatever is useful for test automation projects.

CATEGORIES

BOOKMARKS

Current version of Marathon does not support data driven testing. However a recorded test case can be changed to fetch the test data from a csv file and run the test multiple times. The “csv” module available in Jython-2.5 is needed to fetch the data. As Marathon is presently bundled with Jython-2.2, it is required to update Jython to version 2.5 to use csv reader. Jython-2.5 can be downloaded from Jython website.

Change in project settings:

Update the Python Home under Python path in Marathon Project Settings to point the installation directory of Jython version 2.5.

Change in test case:

A simple example test case recorded for SampleApp looks as follows:

def test():
    java_recorded_version = '1.5.0_24'

    if window('Simple Widgets'):
        select('First Name', 'TestName')
        select('Password', 'P@ssword')
        select('Email', 'TestName@Email.com')
        select('Address', 'Address1, Line1')
        click('save')

        if window('Simple Widgets(1)'):
            click('OK')
        close()
    close()


Assuming the data to be fetched is in “SampleAppTestData.csv”, modify the test script to fetch the data from the csv as below.

import csv

def test():
    java_recorded_version = '1.5.0_24'

    reader=csv.DictReader(file("<PATH_TO_CSV>/SampleAppTestData.csv"))

    if window('Simple Widgets'):
        for record in reader:
            select('First Name', record["Name"])
            select('Password', record["Password"])
            select('Email', record["EmailID"])
            select('Address', record["Location"])
            click('save')

            if window('Simple Widgets(1)'):
                click('OK')
            close()
    close()


Note that Name, Password, EmailID, Location in record["<keyword>"] are the headers in the csv.
CSV file used in example looks as following:

Name,Password,EmailID,Location
TestName1,P@ssword1,TestName1@Email.com,"Address1, Line1"
TestName2,P@ssword2,TestName2@Email.com,"Address2, Line2"
TestName3,P@ssword3,TestName3@Email.com,"Address3, Line3"
TestName4,P@ssword4,TestName4@Email.com,"Address4, Line4"
TestName5,P@ssword5,TestName5@Email.com,"Address5, Line5"
TestName6,P@ssword6,TestName6@Email.com,"Address6, Line6"
TestName7,P@ssword7,TestName7@Email.com,"Address7, Line7"
TestName8,P@ssword8,TestName8@Email.com,"Address8, Line8"
TestName9,P@ssword9,TestName9@Email.com,"Address9, Line9"
TestName10,P@ssword10,TestName10@Email.com,"Address10, Line10"
TestName11,P@ssword11,TestName11@Email.com,"Address11, Line11"
TestName12,P@ssword12,TestName12@Email.com,"Address12, Line12"
TestName13,P@ssword13,TestName13@Email.com,"Address13, Line13"
TestName14,P@ssword14,TestName14@Email.com,"Address14, Line14"
TestName15,P@ssword15,TestName15@Email.com,"Address15, Line15"
TestName16,P@ssword16,TestName16@Email.com,"Address16, Line16"
TestName17,P@ssword17,TestName17@Email.com,"Address17, Line17"
TestName18,P@ssword18,TestName18@Email.com,"Address18, Line18"

Posted by Sampath Posted in Marathon

2 comments so far

  1. Silpa

    select(’First Name’, record["Name"]) This is for textbox.

    How can I select combobox value in script if Marathon doesnt record selecting value from Combobox?

  2. KD

    Unable to understand the problem. Can you post it onto the google groups with more details?

Leave a Reply