I'm trying to make Test Studio verify that if a WPF app has no licence, it prompts for one when it is started. I've got that working, but I want to add a step that deletes a licence file from disk before the app is launched.
What is the best way to add a step that will delete a file from disk? Is there a better way of doing this? (I'm new to Test Studio, and Automation in general)
5 Answers, 1 is accepted
0
Hi Graeme,
Thank you for contacting us.
This can be achieved in a coded step. You should write a code which verify whether the file exists and then delete it.
Here is a simple example of this.
Let me know if that helps.
Regards,
Boyan Boev
Telerik
Thank you for contacting us.
This can be achieved in a coded step. You should write a code which verify whether the file exists and then delete it.
Here is a simple example of this.
Let me know if that helps.
Regards,
Boyan Boev
Telerik
0
Graeme
Top achievements
Rank 1
answered on 10 Dec 2015, 02:26 PM
Thanks. I now have a coded step that looks something like:
string
commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
string
licFile = System.IO.Path.Combine(commonAppData, @
"Vendor\Product\Licence\Product.lic"
);
if
(System.IO.File.Exists(licFile)) {
System.IO.File.Delete(licFile);
}
0
Hi Graeme,
In this case you should implement the same code in OnBeforeTestStarted method in our execution extension.
This method triggers just before the test is started.
Hope that helps.
Regards,
Boyan Boev
Telerik
In this case you should implement the same code in OnBeforeTestStarted method in our execution extension.
This method triggers just before the test is started.
Hope that helps.
Regards,
Boyan Boev
Telerik
0
Graeme
Top achievements
Rank 1
answered on 15 Dec 2015, 12:35 PM
Is there no way to do this without developing a dll in visual studio?
0
Hi Graeme,
Unfortunately there is no other way.
If you want to execute this code before the start of the test this is the only way how to achieve it.
Thank you for your understanding.
Regards,
Boyan Boev
Telerik
Unfortunately there is no other way.
If you want to execute this code before the start of the test this is the only way how to achieve it.
Thank you for your understanding.
Regards,
Boyan Boev
Telerik