版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、What is the correct use of DataRange.MaxRange?Hi there, this piece of code isn't quite behaving the way I expect:Code: Select allif (TestCase.Current.DataContext.CurrentRowIndex = TestCase.Current.DataRange.MaxRange)TestCase.Current.DataContext.CurrentRowIndex is returning the correct row (1 thr
2、ough 6), but MaxRange (aand MinRange) both always return -1.I'm guessing I'm using this wrong, but I'm not sure the correct way to use it. Thanks in advance! carsonw Posts: 173Joined: Tue Nov 08, 2011 10:01 pmTopRe: What is the correct use of DataRange.MaxRange?by Support Team
3、7; Wed Feb 15, 2012 8:46 am Hi,if you are setting a Data Range within your Data Source, MaxRange and MinRange are representing the limits of this Data Range.To get the number of rows returned, you can use following code snippet:view plaincopy to clipboardprintDataSources.Get("<yourConnector&
4、gt;").Rows.Count DataSources.Get("<yourConnector>").Rows.Countwhereas <yourConnector> is the name of your Data Connector.Regards,TobiasRanorex Support Team.Re: What is the correct use of DataRange.MaxRange?by carsonw » Wed Feb 15, 2012 6:08 pm Thanks very m
5、uch! I was hoping to get the binding associated with the current test, rather than having to call it by name (in case the name changes for some reason then I don't have to update the code). I'm not sure if that can be done - if not this works great.carsonw Posts: 173Joined: Tue Nov 08,
6、 2011 10:01 pmTopRe: What is the correct use of DataRange.MaxRange?by Support Team » Thu Feb 16, 2012 12:14 pm Hi,carsonw wrote:Thanks very much! I was hoping to get the binding associated with the current test, rather than having to call it by name (in case the name changes for some reason the
7、n I don't have to update the code). I'm not sure if that can be done - if not this works great.If you want to use the current DataConnector for a TestCase, you could use the following line of code instead of the name of the dataconnector.view plaincopy to clipboardprintstring dataConnec
8、torName = TestCase.Current.DataContext.Source.Connector.Name; Accessing the Ranorex provided dataconnectors from codeby mzperix » Mon Jun 03, 2013 9:54 am Hi,We are using a lot of slightly different SQL query statements to get the required data for our testcases. We like th
9、e way Ranorex provides SQL dataconnectors, but we would like to be able to parametrize the query or sometimes replace the whole query.As I see, accessing the sql dataconnectors' query part can be done from user code, but I don't know how. Can you help me in this topic, please?What I want to
10、do is, to create a code module to manipulate the dataconnectors' query and after run a testcase which will use the modified dataconnector.Regards,Zoltan Majormzperix Posts: 137Joined: Fri Apr 06, 2012 12:19 pmTopRe: Accessing the Ranorex provided dataconnectors from codeby krstcs » Tu
11、e Jun 04, 2013 2:38 pm Zoltan,I have had issues with the simplicity of the data connectors in Ranorex as well. Normally having a very simple connector is not a problem, but there are times when you might need to parameterize the queries.What I finally had to do was create my own connector using the
12、database drivers that are appropriate for what you are working with, but passing in test parameters so I could tailor the results as needed. I then import these results into a simple data table that I use for the actual test case data set.Create a new simple data table with the fields you need. Then
13、 assign those fields to the variables in the test case. Do not add any rows to the table, leave it blank.So, your process in the test suite would be:1. Clear the simple data table. (Always do this first so you don't have corrupted data in the table.)2. Do your custom query through SQL or Oracle
14、drivers and save the result set into the simple data table.3. Run your test case.4. Repeat as needed.Ranorex staff: Could we add a feature request for passing test parameters into the data connectors? Currently the filters in the SQL data connectors are static and it would be very handy to allow us
15、to use test variables in those connector filters.krskrstcs Ranorex Guru Posts: 1298Joined: Tue Feb 07, 2012 4:14 pmLocation: Dallas-Ft. Worth, Texas, USATopRe: Accessing the Ranorex provided dataconnectors from codeby Support Team » Tue Jun 04, 2013 3:03 pm HelloYou can use the SqlDataConn
16、ector class in order to set the query.You can get access to a specific data connector in the Test Suite by using the following code snippet. view plaincopy to clipboardprintforeach (var dataCache in TestSuite.Current.DataConnectorCaches)
17、; var conn = dataCache.Connector as SqlDataConnector; if (conn.Name = "SQLConnector") conn.Query = "select * from Table"
18、; foreach (var dataCache in TestSuite.Current.DataConnectorCaches) var conn = dataCache.Connector as SqlDataConnector; if (conn.Name = "SQLConnector") conn.Query = "select * from Table"Please note that this is only an example, but it shows how you can work with t
19、he SqlDataConnector class.Please read the online API documentation in order to get more information about the SqlDataConnector class.Re: Accessing the Ranorex provided dataconnectors from codeby mzperix » Wed Jun 05, 2013 9:23 am Thank you for your answers. I will update on what I have achieved
20、.How to limit data driven tests frm parent test to child testby cruzez » Tue Jun 03, 2014 11:58 am Hi Group members, Sorry I adding another query to the list (being fairly new to this I am having queries on daily basis)My question is with data driven iterationsI have structured Tests like this1
21、. Setuplaunch and login2. Groupto perform few tests say I have added 5 data driven values in a test say 2a3. TeardownLog off and closeProblem Test suit executes 1+2+2a+3 for each of dataHow can I limit this? I want to execute 1,2 and 3 only once and 2a to be done five times. Test 2a runs only on a p
22、erticular module, I don't think I need to run rest of the tests all the times as it only adding repeated test and takes longer test executionI have added snapshot of my tests.I have seen recent post iteration-question-t6243.htmlBy mine is slightly complicatedI have used Test cases and Groups, I
23、have used different data source like csv and ranorex builtinIn the snapshot as you see, Groups I have used ranorex simple data and top level tests have csv file to include user name password etc. I need to isolate group iterations from Top level iterations AttachmentsRe: How to limit data driven tes
24、ts frm parent test to child testby cruzez » Tue Jun 03, 2014 12:28 pm I have figured out, I guess I can raise new feature request:Provide data source facility for Group Modules as well. I can currently see it is possible with only on Test Case basis.cruzez Posts: 23Joined: Thu Jan 27, 201
25、1 3:03 amLocation: London, UKTopRe: How to limit data driven tests frm parent test to child testby krstcs » Tue Jun 03, 2014 1:48 pm Groups are only containers for test recording modules, nothing more. They have no logic. They are used just like modules, which means there is no way to bind data
26、 connectors to them. Just like modules, they have to be in a test case in order to have a data connector bound to them. That is how Ranorex is designed.If you need to bind a data set to a group, put the group in its own test case and add the data connector to that test case. You can nest groups as d
27、eep as needed.Also, if you are using data with any complexity at all, I strongly recommend using SQL Server Express to store your data. You can use SQL queries to structure the data however you need it. It is much better in the long run than using simple data tables, text, csv, or XLS files.krstcs R
28、anorex Guru Posts: 1298Joined: Tue Feb 07, 2012 4:14 pmLocation: Dallas-Ft. Worth, Texas, USATopRe: How to limit data driven tests frm parent test to child testby cruzez » Tue Jun 03, 2014 2:11 pm Thanks krstcs!You are absolutely right, I will start using sql, I have already sort of lost t
29、he track of my own so many variety of connectors files, builtin ect getting messy cruzez Posts: 23Joined: Thu Jan 27, 2011 3:03 amLocation: London, UKTopRe: How to limit data driven tests frm parent test to child testby krstcs » Tue Jun 03, 2014 2:47 pm Sure thing!If you need help with th
30、e SQL stuff, let me know. The only problem I have with the Ranorex SQL data connector is that it is static, which means it runs the same SQL every time unless you change the SQL query right before the test case runs. So, if you have a truly data-driven test, you would need a lot of modules that chan
31、ge the specific query you are about to run.I use a custom library that has a module that does this for me. I just pass the module the name of the connector I am changing and the query string I want to use now. My test module has variables that hold the information that limits the query (such as a Cu
32、stomerID or ENVIRONMENT, etc.). It looks like this for my query that gets the different URLs for each environment we might run tests against (TEST, PROD, PREVIEW, etc.):Code: Select all public class Set_WEBInfoSQL_for_ENVIRONMENT : ITestModule /
33、<summary> / Constructs a new instance. / </summary> public Set_WEBInfoSQL_for_ENVIRONMENT() / Do not delete - a parameterless constructor
34、is required! string _ENVIRONMENT = "TEST" TestVariable("F400087E-BE86-4E24-A2AF-E6EEDC382599") public string ENVIRONMENT
35、160; get return _ENVIRONMENT; set _ENVIRONMENT = value; / <summary> / Performs the playback of actions in this module.
36、0; / </summary> / <remarks>You should not call this method directly, instead pass the module / instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method / that will
37、 in turn invoke this method.</remarks> void ITestModule.Run() Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100;
38、60; Delay.SpeedFactor = 1.0; TCS_LIB.Data.SetupSqlDataConnector("WEBInfoSQL", string.Format("exec GetWEBInfo_for_ENVIRONMENT ENVIRONMENT=N'0'", ENVIRONMENT);
39、0; I uses string.Format because it is easier to read than <"exec GetWEBInfo_for_ENVIRONMENT ENVIRONMENT=N'" + ENVIRONMENT + "'">.Then TCS_LIB.Data.SetupSqlDataConnector(string, string) looks like this:Code: Select all public
40、static void SetupSqlDataConnector(string dataCacheName, string queryString) (SqlDataConnector)DataSources.Get(dataCacheName).Connector).Query = queryString; Just drop the module with the code from the top part above into the test s
41、uite right before the test case you will be using the data for. Then, you will need to bind the variable just like any other recording module.This allows you to get results at runtime instead of having to structure the data completely at design time.Also, I put ALL of my queries inside stored proced
42、ures in the DB, so all I have to call from Ranorex is the stored procedure. That way the DB handles data stuff and Ranorex handles test stuff.krstcs Ranorex Guru Posts: 1298Joined: Tue Feb 07, 2012 4:14 pmLocation: Dallas-Ft. Worth, Texas, USATopRe: How to limit data driven tests frm parent tes
43、t to child testby cruzez » Tue Jun 03, 2014 5:32 pm Once again, thank you so much krstcs, this is great helpI have already moved all into DB and grouped values types into one table and just use filter to drive data for each test case and I was about to fire another question and noticed your rep
44、ly, using SQL gave me more flexibility and limit number of tables for similar values or scenarios.I will implement your method, its only right thing to do I dont want to add connection string to add each possibly will come back with more queries You gave me lot of hints for me to try out.-Ranorex Te
45、st Case SettingsThe 'General' tab of the test case's properties dialog is mainly used to setup how a broken test case impacts other test cases within the test suite.NameName of the test caseDescriptionDescription of the test case (same as shown within the description column of the t
46、est suite editor). Use the HTML text editor to format the description and to add links to the description. The formatted description will be represented as HTML content in the generated reportReport LevelSpecifies the level of messages written to the report fileError BehaviorSpecifies
47、 the behavior of the test case and the test suite in case of on error. For further information please have a look at the next paragraph.The following figures try to illustrate several Error Behavior settings:Set to 'Continue with iteration' if, in case of an error, the case should not break
48、continue with the next iterationSet to 'Continue with sibling' if, in case of an error, the currently running test case should break and the execution should continue with the sibling test caseSet to 'Continue with parent' if, in case of an error, the currently ru
49、nning test case should break and the execution should continue with the sibling of the parent test caseSet to 'Stop' in order to break the test suite run in case of an errorContinue with IterationContinue with SiblingContinue with ParentStopTest case properties dialogUse
50、the context menu to change the report level or the error behavior for multiple test cases.Specifying error behavior for multiple test casesUsing Data in Test SuitesAs already explained in Lesson 3: Data-Driven Testing you can make your automation data-driven by using variables in your modules (
51、recordings, code modules) as well as in your repositories. These variables can be connected to internal or external data sources and parameters. Different kinds of Data ContainerLet's have a look at the different kinds of data container:Module Variables:Variables are the interface between a
52、 module and the nesting test case, or - if module groups are used - the module group, respectively.Variables can be used in recording modules (as described in section Using Variables within Recordings), code modules (as described in section Using Variables with Code Modules) and repos
53、itories (as described in section Using Variables within the Repository).After building up the test suite with its test cases as described in the previous sections, the included module variables can be bound to group variables, constant values, data columns, or parameters.Constant Values:Constant val
54、ues can be used in module groups to hide module variables outside a module group. This can help to reduce the complexity and increases the clarity of module groups. For further details have a look at the section about the Module Group Editor.Group Variables:In module groups, group variables are
55、 the interface between the nested modules and the nesting test case.For further details have a look at the section about the Module Group Editor.Data Columns:The columns of a data connector are called Data Columns and specify the columns from external data sources.Have a look at the d
56、ata connectors section (Data Connectors) to get an overview about the different kinds of data connectors. Data columns can be connected to variables in the data binding dialog of a test case as described in section Combining Variables with Test Data.Parameters:Module variables can also be bound
57、 to parameters. A distinction is made between local parameters, which are part of a specific test case and are available in the test case and all child test cases, and global parameters which are available in the whole test suite.Unlike local parameters, global parameters can be set from the command line as explained in section Running Tests via Command Line.Have a look at the section Combining Variables with Parameters to see how parameters can be connected to variables.Scope of Data ContainerGlobal parameters are available in the whole test suite. This means
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 智能仪器仪表课程设计
- 手术室出科实习小结范文
- 2024年度网红直播平台店铺使用权独家转让合作协议下载3篇
- 春节放假的通知集锦5篇资料
- 2025年山东济宁邹城市太平镇城乡公益性岗位招聘187人历年管理单位笔试遴选500模拟题附带答案详解
- 2025年山东济宁市工业和信息化局所属事业单位急需紧缺人才引进2人管理单位笔试遴选500模拟题附带答案详解
- 2025年山东济南市槐荫区幼儿园招聘工作人员273人管理单位笔试遴选500模拟题附带答案详解
- 很押韵很有气势的网络安全宣传标语
- 园长中班家长会发言稿
- 师德标兵主要事迹(5篇)
- 消防部队干部竞争上岗答辩题1
- 增服叶酸预防神经管缺陷理论知识考核试题及答案
- 施工现场临水施工方案完整
- 单证管理岗工作总结与计划
- 人教版九年级上册数学 21.3 实际问题与一元二次方程(传播问题)专题练习(Word版含答案)
- 安全安全隐患整改通知单及回复
- GB∕T 799-2020 地脚螺栓-行业标准
- “僵尸型”社会组织注销登记表
- 田径活动记录第一学期记录
- CDI-EM60系列变频调速器使用说明书
- 【汇总】高二政治选择性必修三(统编版) 重点知识点汇总
评论
0/150
提交评论