Copying File from one folder to another through a code mod

Ask general questions here.
afredrick
Posts: 3
Joined: Mon Nov 04, 2013 11:53 pm

Copying File from one folder to another through a code mod

Post by afredrick » Fri Nov 21, 2014 4:27 pm

Hi,

I am having an issue with a code module and I'm trying to figure out why it's not working now compared to the way I had it set up earlier.

So, my initial setup used to be a recording with a code module within to copy a file from our internal network to the test station. This was working fine.

I then decided that it didn't make sense to have a single code module under a recording, so i recreated it as just a code module. This worked for a few times and then all of a sudden just stopped. I use a couple of variables within to get my testcase name, and when I set a break point inside the code module, all paths are correct but it does not transfer over. But when I hard code a path it seems to work fine.

What I'm trying to figure out is if there is any real difference between having the code module within the recording. It seems like it runs faster when it is just a code module, and hoping that the speed isn't the reason (like the code module is finishing before the action is done).

Any Ideas?

Thanks

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Copying File from one folder to another through a code mod

Post by krstcs » Fri Nov 21, 2014 6:44 pm

First, when you have questions, please include the following information:
1. Full Ranorex version (i.e., 5.2.0)
2. Windows version (i.e., Windows 7 Pro x64)
3. Technology used to create the system under test (Java, Web, .NET, etc.)

Second, everything should work just fine in a user-code module, I use them all the time. The only real difference is that don't have some of the overhead that the Recording Modules do, so if you know how to code, they work great (and are a little faster, as you noted).

Finally, if your test worked as a user-code module and then "all of a sudden just stopped" then that suggests that either you changed the test/environment, or the system under test changed (if this is related to the SUT). Find out what changed and that should lead you to the solution.



On a personal note, I find that using Ranorex for simple file-manipulation is like using a tow-truck to haul a bicycle out of a ditch. It works, but it's a bit of over-kill and requires a lot of overhead. If you are not needing to validate the file transfer (as in, the file transfer isn't what you are testing) then you should probably use a batch file or powershell script. If you really need to do heavyweight environment management I would suggest using a continuous integration solution like Jenkins.
Shortcuts usually aren't...