Forum Discussion
I do exactly this.
All my tests are keyword and data driven from Excel sheets.
But I wrote my own framework (all in Script Extensions) to do so. Using the DDT Excel driver wasn't flexible enough for me. Everything can be toggled on or off by the user. It also does everything relative to the project path (as mentioned by baxatob) so the whole project is completely portable. When run, it expects the project to contain a "working" directory containing and input, result and log folders. If they are not present, it creates them, logs an appropriate message in the newly created log folder and then either continues the run, or ends, depending on which parts of the working directory were missing. (Obviously, it can't continue if there is no input folder!)
But like I say, this is an entire framework built from scratch. Any project making use of it (ie - all of them!) then only has to have a single, fairly short, driver script in order to run. On top of that I have a few libraries of generic functions - ones used for application control rather then part of framework so not in script extensions. And the final layer is project specific script files and the name map.
Took a bit of work to put it all together, but it's worth it now.
The framework that I presented in the October TestComplete Academy 301 does pretty much the same thing that Colin_McCrae described, albeit in a different implementation and not nearly so robust. Generally speaking, there are probably any number of ways of doing what you want done.
For example, let's say that you have a whole bunch of keyword tests, each one representing a particular test case. Every time you run the project, you don't necessarily want to run ALL your tests, just are targetted selection. What you could do is create a different folder for each run configuration with either an Excel sheet or a CSV file in it. Each row in the file would contain two columns. Column 1 would be the name of the keyword test ('PageLogin', 'PrintFile', etc). The second column would be a string of parameters to pass in, if necessary ("'myusername', 'mypassword'"). You would then write something like this (JScript/JavaScript).
function runMyTests(testListFile) { var myTestList; try { myTestList = DDT.CSVDriver(testListFile); while (!myTestList.EOF()) { if (aqObject.IsSupported(KeywordTests, myTestList.Value('TestName')) { eval('KeywordTests.' + myTestList.Value('TestName') + '.Run(' + myTestList.Value('ParameterString') + ')'); myTestList.Next(); } } catch (exception) { Log.Warning('Exception : ' + exception.message, exception.stack); } finally { if (myTestList != undefined) { DDT.CloseDriver(myTestList.Name); } }
Run this as the only TestItem in Project.TestItems for your project and, effectively, it will execute all the keyword tests in your project that you have configured in the indicated CSV file. All you would have to do is pass in the necessary file name and path and you're good to go.
Again, this is not the ONLY way to do it but it demonstrates another methodology to do what you're asking. This just goes to show that, depending upon your need and skill, you can implement what you're asking in a variety of different ways. It is left to you, then, to determine what meets your needs best.
Related Content
- 2 years ago
- 8 years ago