Skip to main content



      Home
Home » Eclipse Projects » RCP Testing Tool » Data Driven using RCPTT(Data Driven using RCPTT)
Data Driven using RCPTT [message #1701961] Fri, 17 July 2015 03:07 Go to next message
Eclipse UserFriend
I would like to use data driven concept in RCPTT for the below purpose.

I have a test case, where user wants to create multiple projects and project names should be defined in csv and those values should read during script execution.

Could you please help me on this.
Re: Data Driven using RCPTT [message #1701973 is a reply to message #1701961] Fri, 17 July 2015 04:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi Vinod,

Created a procedure and example test for your interest (see attached).
You can use it as an example.

1) So there is a MyProcedures ECL Script Context where you may find the following procedures:


proc "index-of" [val list -input] [val item] {

$list | each [val elem] [val index] {

if [$elem | eq $item] { $index }

} | to-list | get 0 [int "-1"]

}


proc "get-value" [val table] [val columnName] [val rowNumber] {

let [val columnIndex [$table | get columns | to-list | index-of $columnName]] {

$table | get rows | to-list

  | get $rowNumber | get values | to-list 

  | get $columnIndex

}

}



2) And the TestCase with this ECL Script Context added:


//set initial index value for foreach loop
global [val -name indx -value  0] 

//please replace file uri here
let [val table [read-csv-file "file:///Users/Ulik_MacAir/Desktop/ccc.csv"]] {

//..and here
read-csv-file "file:///Users/Ulik_MacAir/Desktop/ccc.csv" | get rows | foreach {

//here you can do anything you wish, e.g. create a new Project with a key name instead of logging it
get-value $table "Name" $indx | log

//increasing index value +1
global [val indx [$indx | plus 1]] -override 

}
}



3) ccc.csv file attached as well.

I hope it will be helpful.

Kind regards,
Ulyana.

  • Attachment: DataDriven.test
    (Size: 2.44KB, Downloaded 132 times)
  • Attachment: ccc.csv
    (Size: 0.06KB, Downloaded 137 times)
Re: Data Driven using RCPTT [message #1702008 is a reply to message #1701973] Fri, 17 July 2015 08:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

The below is the script which I am using. For the below script I want to pass different project names through csv file.

Expected : Would like to pass different project names and like to create multiple projects.

Please provide the script ASAP.



get-menu "File/New/Project..." | click
with [get-window "New Project"] {
get-tree | select "General/Project"
get-button "Next >" | click
with [get-editbox -after [get-label "Project name:"]] {
set-text testproject
}
get-button Finish | click
}

[Updated on: Tue, 21 July 2015 00:52] by Moderator

Re: Data Driven using RCPTT [message #1702561 is a reply to message #1702008] Thu, 23 July 2015 04:57 Go to previous messageGo to next message
Eclipse UserFriend
Please provide the soultion
Re: Data Driven using RCPTT [message #1702719 is a reply to message #1702561] Fri, 24 July 2015 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

In the following snippet it is needed to change path to the csv-file:
read-lines [uri-from-path "C:/Users/olga/Downloads/ccc.csv"] | foreach [val testproject]{
get-menu "File/New/Project..." | click
with [get-window "New Project"] {
get-tree | select "General/Project"
get-button "Next >" | click
with [get-editbox -after [get-label "Project name:"]] {
set-text $testproject
}
get-button Finish | click
}
}


Please take a look and let me know if you have any questions.
Re: Data Driven using RCPTT [message #1702801 is a reply to message #1702719] Fri, 24 July 2015 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi Olga,

Thanks for the reply and it is working as expected Smile. Thank you very much.

I have one more clarification in continuation to my previous question.

Please see the below script. In this script, it has two wizards. One is Project creation wizard and Second one is Data model creation wizard. I have a test case first I have to create project and under the project I have to create a data model. Using single csv file, can I pass two different values to two different wizard.

Sample csv data file:

PN1,DM1
PN2,DM2
PN3,DM3


get-menu "File/New/Project" | click
with [get-window "New Project"] {
get-editbox -after [get-label "Project File Name"] | set-text PN
get-button Finish | click
}
get-view "Package Explorer" | get-tree | select PN | get-menu "New/Data Model" | click
with [get-window "New Data Model"] {
get-editbox -index 5 | set-text DM
get-button Finish | click
}


Please provide the solution ASAP. Waiting for your early reply.

Thanks
Vinod
Re: Data Driven using RCPTT [message #1703027 is a reply to message #1702801] Tue, 28 July 2015 02:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Could you please update me for my question with resolution.

Thanks
Vinod
Re: Data Driven using RCPTT [message #1703163 is a reply to message #1703027] Wed, 29 July 2015 01:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Using Ulyana's script I've made the following snippet:

proc "index-of" [val list -input] [val item] {
	$list | each [val elem] [val index] {
		if [$elem | eq $item] {
			$index
		}
	} | to-list | get 0 [int "-1"]
}

proc "get-value" [val table] [val columnName] [val rowNumber] {
	let [val columnIndex [$table | get columns | to-list | index-of $columnName]] {
		$table | get rows | to-list | get $rowNumber | get values | to-list | get $columnIndex
	}
}

//set initial index value for foreach loop
global [val -name indx -value  0] 

//please replace file uri here
let [val table [read-csv-file[uri-from-path "/Users/olgayurchuk/Downloads/test.csv"]]] {

//..and here
$table | get rows | foreach [val item] {

//here you can do anything you wish, e.g. create a new Project with a key name
get-view "Test Explorer" | get-tree | get-menu "New/Project..." | click
with [get-window "New Project"] {
    get-tree | select "RCP Testing Tool/RCP Testing Tool Project"
    get-button "Next >" | click
    get-editbox -after [get-label "Project name:"] | set-text [get-value $table name1 $indx]
    get-button Finish | click
}
//here you can create files in your project
get-view "Test Explorer" | get-tree | select [get-value $table name1 $indx] | get-menu "New/Test Case" | click
with [get-window "New Test Case"] {
    get-editbox -after [get-label "Name:"] | set-text [get-value $table name2 $indx] 
    get-button Finish | click
}

//increasing index value +1
global [val indx [$indx | plus 1]] -override 

}
}


In my csv file name1 and name2 are column headers.
Please let me know if this construction is suitable for you.

[Updated on: Wed, 29 July 2015 01:36] by Moderator

Re: Data Driven using RCPTT [message #1703173 is a reply to message #1703163] Wed, 29 July 2015 03:02 Go to previous message
Eclipse UserFriend
Its working as expected.

Thank you very much for providing required solution Smile
Previous Topic:running RCPTT during development
Next Topic:Excessive memory consumption in Test Runner
Goto Forum:
  


Current Time: Sat Jun 21 08:17:17 EDT 2025

Powered by FUDForum. Page generated in 0.05553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top