Ask a Question

Refresh files

CraigB
Contributor

Refresh files

Hi

 

I can't find the command to refresh files.  How do I force TestComplete to refresh all files so that changes are reflected in the script files it's using to run tests if I change something while a test is running?  I can hack around the problem by making and undoing a change and saving the file (or, equivalently, executing touch to change the file timestamp).  But obviously there's a way to force a refresh without having to do that sort of hack.  I just can't find it and nothing like that comes up in a search.  Does anyone know where that command is?

 

Thanks

Craig

20 REPLIES 20
cunderw
Community Hero

Simple answer you can't, TC doesn't even let you change your files while a test is running. What is the use case for this? If you're changing your scripts as a test is running that kind of defeates the purpose of automation.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped

The use case is that when an error comes up during a test I don't necessarily wait until the test run completes to start fixing the script that led to the problem.  But if I save the changes before the test run completes I then have to make an additional, unnecessary change to get TestComplete to  refresh the changed files.

You need to look at implementing events in TestComplete.

Especially, OnLogError event

 

Cheers

Lino

Does that mean there's a function that I can execute in a script that will cause TestComplete to reload all script files?

tristaanogre
Esteemed Contributor

No.

When you click "run" in TestComplete to run a project, it basically does a Runtime compile of all the script files.  So, while you can change files while the project is executing, it will not take effect until the next execution.  This is why there are certain options that you can change during a run and certain ones you can't.  

The suggestion for OnLogError is to allow you to execute special code when an error is written to the log.  It doesn't allow you to CHANGE the scripts while running, just that you can set up to run code on an error that will do certain tasks at that error.  You still can't change code and have that changed code execute.  Sorry, man.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I'm not trying to change any scripts while the tests are running, at least not in the sense of having changes be executed by the tests.  What I want is extremely simple.  Currently, if I make a change to a script while no tests are running, when I go back to TestComplete it asks if I want to refresh the files.  All I want is to be able to refresh the changed files once the test run is complete without either having to wait until the test run is complete to save changes or make unnecessary changes and resave the file so that TestComplete will refresh them.  I'm not asking for JIT or Edit and Continue.  All I'm trying to accomplish is the extremely simple task of having TestComplete refresh the files after a test run even if they were changed while the tests were running.

The problem is that the changes don't even take effect on the next run because unless I hack my way around it, TestComplete doesn't refresh the changed files if they were changed while it was running tests.

tristaanogre
Esteemed Contributor

Generally... don't change files while the tests are running.  I think TC flushes back to disk anything that was used for running.  

If you need to alter files while the test is running, I would suggest you open a copy of TC on another machine, make your changes, check them into your source control, and then redownload to the execution machine.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

TC doesn't overwrite files I change while it's running.

That proposed solution is even worse than what I'm currently having to do.  It's bad enough that I have to make unnecessary changes to the files so that the timestamp is changed to get TC to refresh the changed files.  Making unnecessary source repository commits on a second machine (for which I'd have to buy a second TC license) and then pulling those to the primary machine...  The less said about how ridiculous that is, the better.

cancel
Showing results for 
Search instead for 
Did you mean: