I'm working on extending an ANT build script to allow a TeamCity build agent to run Selenium tests.
In doing so there is a server required to start with selenium which isn't shutdown at the end. So I added an extra target to execute a taskkill on the exe name at the end of every TC build.
Does taskkill need the absolute path to the exe, because the following isn't working;
<target name="shutdown.server" depends="init.properties" description="Shutdown the server after Selenium">
<exec osfamily="windows" executable="cmd.exe" spawn="true">
<arg line="taskkill /f /t /im app.exe"/>
</exec>
</target>
The process seems to have a few children which is why I've gone with /f /t
but as I say, none of them shutdown at the moment.
Ant is a Java-based build tool created as part of the Apache open-source project. You can think of it as a Java version of make. Ant scripts have a structure and are written in XML. Similar to make, Ant targets can depend on other targets.
To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.
Well that was easy;
<target name="shutdown.server" depends="init.properties" description="Shutdown the server after Selenium">
<exec executable="taskkill">
<arg line="/im app.exe /f /t"/>
</exec>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With