Post-Build Comands

Ranorex Spy, Recorder, and Studio.
AccidentReport
Posts: 76
Joined: Tue Dec 04, 2012 2:30 pm

Post-Build Comands

Post by AccidentReport » Mon Jan 12, 2015 11:45 am

I have a piece of code in my post-build to copy the built test files from the PC I'm on to the PC used to run the tests. This works brilliantly. My issue is that when I am building my tests I often run them to test them locally. Of course this triggers a build and then copies my tests to the other PC even though they may not now be in a state to be run.

Is there a way to do this properly so that I can execute tests locally without triggering the post-build command?

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

Re: Post-Build Comands

Post by krstcs » Mon Jan 12, 2015 5:37 pm

You could put the copy instruction in the Release build configuration instead of in Debug. Then when you want to actually copy the files, you would switch to the Release configuration.

The other thing you could do is use a build server with a continuous integration system like Jenkins. Then, you would do the work on your system, and the build server would only run new builds when you push (finished) code up to your code versioning system (CVS) like Git/TFS/SVN. If you aren't using a CVS, you should be. Even if you are the only person working on the project, it will save you a lot of work if your system crashes, or if you just mess something up.
Shortcuts usually aren't...

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Post-Build Comands

Post by Ciege » Mon Jan 12, 2015 9:47 pm

If building in Visual Studio you can add code to the pre and post build events. For example, this post build event with only run commands when on the machine named DEVMACHINENAME:

Code: Select all

if NOT %ComputerName% == DEVMACHINENAME GOTO end
echo "Put commands here for dev machine only ".
:end
I'm not sure if RanorexStudio handles pre and post build events the same way.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Post-Build Comands

Post by krstcs » Mon Jan 12, 2015 9:57 pm

It does. The build section of the project properties is pretty much the same, functionally, as VS.

I hadn't mentioned that because he seems to be building everything on the one system, so this wouldn't have the desired effect unless he moved to a dev-system/build-system setup where they were separate.
Shortcuts usually aren't...

AccidentReport
Posts: 76
Joined: Tue Dec 04, 2012 2:30 pm

Re: Post-Build Comands

Post by AccidentReport » Tue Jan 13, 2015 9:43 am

krstcs wrote:You could put the copy instruction in the Release build configuration instead of in Debug. Then when you want to actually copy the files, you would switch to the Release configuration.
So if I did this I would need to change the Configuration under the build menu to Release, build it and then switch back? Would running it via F5 or the play button use the Debug or Release configuration if the configuration was set to release? I know that may seem like a stupid question but running the tests is under the debug menu! Also, we have multiple projects in the solution we work on independently so I assume I would have to ensure that we only ever build the single project wed work on and not the whole solution?
krstcs wrote:I hadn't mentioned that because he seems to be building everything on the one system, so this wouldn't have the desired effect unless he moved to a dev-system/build-system setup where they were separate.
At present there are two developers working on the tests locally and then the tests are run from another separate machine. We have started looking into using Jenkins to actually manage the build and execution of the tests but we haven't made much progress due to time restraints at present!

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

Re: Post-Build Comands

Post by krstcs » Tue Jan 13, 2015 3:32 pm

The debug menu in Ranorex (and SharpDevelop and Visual Studio) runs the configuration that is selected. It just attaches the .NET debugger to the process, which is why it's called Debug.

The debug configuration usually includes the debug symbols for easier debugging using the .NET debugger, while the Release configuration doesn't. The debug config creates a debug symbols file that the debugger reads so it can understand and use the actual symbols instead of the machine encoding. The Release configuration also usually includes some code optimizations that make the executable run faster, but which, in debug, would cause issues.

Does that help?
Shortcuts usually aren't...

AccidentReport
Posts: 76
Joined: Tue Dec 04, 2012 2:30 pm

Re: Post-Build Comands

Post by AccidentReport » Tue Jan 13, 2015 4:28 pm

Yes that helps. Thanks.

I think we'll use the debug/release config as suggested for now. At least until something better gets setup!