Contributions
- 11 years agoPlace AQtime QuestionsAQtime Questions7.1KViews0likes0Comments
Re: Enable/Disable Test Items via Code
Thanks. Unfortunatelly I didn't found any magic tricks in your code ;-) You execute the tests via Runner.CallMethod and organize your error log via Log.AppendFolder. With the same disadvantages my own "framework" has. I think TC needs improvement here.2.8KViews0likes0CommentsRe: "try ... except" and Runner.CallMethod
Note to myself: never Post a code snippet without ever executing it. Ok, now I have a working code snippet. Also "Evaluate" needs the Unitname: procedure Foo(Message: string); begin raise('Foo-Exception ' + Message); end; procedure Execute; begin try Evaluate('Unit1.Foo(''From Evaluate'')'); // Exception inside Foo is successfully caught except Log.Message(ExceptionMessage); end; try Runner.CallMethod('Unit1.Foo', 'From CallMethod'); except Log.Message(ExceptionMessage); // Exception inside Foo is not caught. It turns in a "Script Runtime Error" an breaks the execution. end; end; The expectedbehavioris that "Execute" runs successfully and posts two messages to log. But the second exception stops the execution. Regarding the idea to avoid the exception: This is "impossible" because I architectured my tests around exceptions ;-) I write several conditions like I do in my applications unit tests: CheckEquals(1, MyValue); CheckFileExists(...) Check(Condition); etc. The code should abort the current test when a condition is not met, but this should not stop other tests from starting. To respect a return value would make the tests unreadable.978Views0likes0CommentsTestComplete (Code Editor) is slow
Hi, working with TestComplete is a pain for me. I cannot believe that such a mature application has so much usability and speed flaws. So I think there is something wrong with my computer/environment. I try to list majorannoyances, and hope somebody can tell me how to overcome them: First my setup: I'm running Win7-64, 12GB RAM, Core i7-920, my test project checked out on a SSD. I think this is a very fast machine. I don't use built in source control features of TC, but I'm working in a subversion working copy. I have about 400 script files (delphi script) in my project. My TC-Version is 8.70.727.7 I already disabled all plugins I don't think arenecessaryfor my application (written in Delphi). 1. The Code Editor is slow. I can type faster that the editor can show. 2. I cannot Edit while debugging. Explanation: Stepping through the code I find bugs. So I want to fix them, add a comment, or something like that. I know I cannot expect the script reflecting the changes during the current run, but I want to edit the files for next test run. 3. Stopping a test: I have to wait several seconds (5-10) until I can type again. I have disabled that the testresults are shown after the test run. This saves a lot of time. Before it was very very anoying (spot a bug, stop the execution, click on the line to fix it, *bam* TC takes away my editor and switches to the test results). 4. TC crashes several times a day. I encountered several UI bugs which are not as problematic, but are annoying too: * Test Item-Tree: Drag&Drop doesn't always behave correctly (a flat list gets completely nested when dropping on another item) * Deleting a Item from the Watch List via <DEL>, Confirm Dialog, Item is deleted, next item is focused, <DEL>, Confirm-Dialog, nothing happens Is there anything I can do to speed up TestComplete? Compared to my main development environment (Delphi) TestComplete feels awkward slow. I'm really disappointed. The "Run Test"-"Fix Bug"-"Run-Again"-Cycle takes so much time which makes me so frustrated after some minutes working.20KViews1like5CommentsRe: "try ... except" and Runner.CallMethod
Sorry, my example was wrong. In my "real world" test I add the unit name. This should be a more correct sample to demonstrate the problem: [Unit1.sd] procedure Foo; begin raise('Foo-Exception'); end; procedure Execute; begin try Evaluate('Foo');// Exception inside Foo is successfully caught except Log.Error( ExceptionMessage); end; try Runner.CallMethod('Unit1.Foo'); except Log.Error( ExceptionMessage);// Exception inside Foo is not caught. It turns in a "Script Runtime Error" an breaks the execution. end; end;978Views0likes0Comments"try ... except" and Runner.CallMethod
Hi, I have trouble with Runner.CallMethod. I'm not able to handle exceptions occuring inside the method call. See this code snippet: procedure Foo; begin raise('Foo-Exception'); end; procedure Execute; begin try Evaluate('Foo');// Exception inside Foo is successfully caught except Log.Error( ExceptionMessage); end; try Runner.CallMethod('Foo'); except Log.Error( ExceptionMessage);// Exception inside Foo is not caught. It turns in a "Script Runtime Error" an breaks the execution. end; end; I cannot simple use Evaluate because it's not able to call methods from units which aren't included, but Runner can. It's no option for me to include those units because it's a framework which executes my tests defined elsewhere. Is it a bug or by intention?19KViews0likes5CommentsRe: Enable/Disable Test Items via Code
How do you actually run a test referenced by a line in the CSV file? I found a similar solution: I don't iterate over a CSV file but the TestStructure. I disabled all top level items but the one which iterates over all others. I can now apply as much logic for each test item and than decide to run it or not. To run a test I call "eval(scriptName)" or "Runner.CallMethod(scriptName)". Using Log.AppendFolder I can structure the log so I can distinguish which test is run. It's nearly what I want, but the execution summary is not as clean as I'd like. TC shows a nice summary of the test run, but now as all tests are merged into one its nearly useless. It also slows down Internet Explorer when viewer the exported (mht-)log file because one entry gets huge. I would really like to create "Log Items" myself to structure the log. Is there any possibility to do that?2.8KViews0likes0CommentsEnable/Disable Test Items via Code
Hi, I don't want all tests of my project to be run all the time. I have structured the tests like that (in the "Test Items" panel): EnableTests [-] SmokeTests * Test 1 * ... * Test N [-]DetailedTests * Test 1 * ... * Test N The first Test "EnableTests" should enable the SmokeTest-Group and only if nightly testing "DetailedTests". I'm able to scan through all test items and see if they are "enabled", but trying to set the property results in an error. E.g. (Delphi Script): Project.TestItems[1].Enabled := True; Results in: --------------------------- Wrong number of parameters or invalid property assignment. Enabled --------------------------- How do I enable/disable a specific test item via code? Is there a better location for enabling tests than using a test itself for that? If there isn't any possibility to do it like that, maybe I can prevent a test from starting via "Test Engine Events"->OnStartTest? Thanks in advance for any help.18KViews0likes14Comments