Ranorex變量類(lèi)型與用數(shù)據(jù)連接器_第1頁(yè)
Ranorex變量類(lèi)型與用數(shù)據(jù)連接器_第2頁(yè)
Ranorex變量類(lèi)型與用數(shù)據(jù)連接器_第3頁(yè)
Ranorex變量類(lèi)型與用數(shù)據(jù)連接器_第4頁(yè)
Ranorex變量類(lèi)型與用數(shù)據(jù)連接器_第5頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論