简体   繁体   English

用Gradle进行JavaScript单元测试?

[英]Unit testing javascript with Gradle?

I'm new to unit testing. 我是单元测试的新手。 We have had some success with compiling and zipping js, compiling LESS and creating basic tasks to copy files. 我们在编译和压缩js,编译LESS以及创建复制文件的基本任务方面取得了一些成功。 Right now, though, I'm trying to do a sample unit test with a simple javascript function. 不过,现在,我正在尝试使用简单的javascript函数进行示例单元测试。 I have a QUnit test working in the browser, but I'm having trouble putting the pieces together. 我有一个在浏览器中运行的QUnit测试,但是在将各个部分组合在一起时遇到了麻烦。 What other tools or plugins do I need? 我还需要其他哪些工具或插件? What are my next steps? 我下一步要做什么? What should my build.gradle look like? 我的build.gradle应该是什么样的?

This is quite a broad question. 这是一个广泛的问题。 What is your biggest issue? 您最大的问题是什么?

I'm going to go ahead and assume it is actually getting a browser to start on you CI server and getting the results. 我将继续进行下去,并假定它实际上是在CI服务器上启动浏览器并获得结果。

For that there are a number of options, easily found by searching for continuous intergration, javascript and unit test. 为此,可以通过搜索连续集成,javascript和单元测试轻松找到许多选项。

I found Running JavaScript unit tests headlessly in a Continuous Integration build here on stackoverflow. 我发现此处的Stackoverflow 的持续集成构建中 ,疯狂地运行JavaScript单元测试 This question has a good answer that you should be able to adapt for use with gradle. 这个问题有一个很好的答案,您应该能够适应gradle的使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM