用rake帮助开发erlang项目(8)

本文介绍了一种使用Erlang进行自动化测试的方法,通过Rake任务实现项目的自动测试流程,能够处理相互依赖的Erlang文件编译,并确保所有测试模块被执行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、自动测试我的项目。

2、能应付相依赖erl文件的编译。

3、rake的默认任务就是自动测试。

 

task :default => [:test_all]
task :test_all =>[:init_unit_test,:complie] do |t|
  beams = FileList["./bin/*.beam"]
  beams.each do |b|
    base_name = File.basename(b,".beam")
    if base_name =~ /test_*/
      puts "running #{base_name}..."
      puts(sh "erl -noshell -s #{base_name} main -s init stop")
    end
  end
end

 

 结果:

 

exist ./test/test_area_server.erl!
exist ./test/test_dist_demo.erl!
exist ./test/test_hello.erl!
exist ./test/test_kvs.erl!
complie ./srcs/area_server.erl
complie ./srcs/dist_demo.erl
complie ./srcs/hello.erl
complie ./srcs/kvs.erl
complie ./test/test_area_server.erl
complie ./test/test_dist_demo.erl
complie ./test/test_hello.erl
complie ./test/test_kvs.erl
running test_area_server...
true
running test_dist_demo...
true
running test_hello...
true
running test_kvs...
true

 

1、自动测试我的项目。

2、能应付相依赖erl文件的编译。

3、rake的默认任务就是自动测试。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值