如何执行.bat文件运行从控制器/工作/服务测试用例 [英] How to execute .bat file to run test cases from controller / job / service

查看:312
本文介绍了如何执行.bat文件运行从控制器/工作/服务测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从.JOB文件调用批处理文件定期地执行我的测试情况下,此
我的任务文件中写道低于code

 调用Runtime.getRuntime()EXEC(C:testcase.bat)

上面一行是调用批处理文件,打印批处理文件的命令,我没有得到任何输出。

但同样的事情曾与静态Java文件中,可以能够运行测试用例。

请让我知道如何从我的控制器/服务/工作

调用批处理文件

批处理文件包含以下命令:

 :D
CD D:\\工作区\\ MyApp的
乳头的Grails应用


解决方案

调用Windows命令处理器来运行你的批处理文件,而不是假设操作系统会自动看着办吧。 code像下面为我工作。

 过程batchFileProc =调用Runtime.getRuntime()EXEC(CMD / C开始C:\\\\ batchfile.bat)

I want to invoke batch file from .job file to execute my test-cases periodically, for this I wrote below code in the job file

Runtime.getRuntime().exec("C:testcase.bat")

above line is calling batch file, printing the batch file commands and i am not getting any output.

But the same thing worked with static java file and can able to run the testcases.

please let me know how to call batch file from my Controller / Service / Job

batch file contains below commands :

:d
cd D:\workspace\MyApp
grails teat-app

解决方案

Call the windows command processor to run your batchfile instead of assuming the operating system will automatically figure it out. Code like the following works for me.

Process batchFileProc= Runtime.getRuntime().exec("cmd /c start c:\\batchfile.bat")

这篇关于如何执行.bat文件运行从控制器/工作/服务测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆