doubeng9407 2009-04-27 04:55
浏览 26
已采纳

PHP和源代码控制:在哪里进行单元测试等?

I'm using Bazaar for version control, which I'm very happy with. In Bazaar every tree/project in source control is called a 'branch'.

Currently I have a 'main' branch for the actual application, and a 'dev' branch which houses some things like unit tests, as well as the user manual, etc. This way, both the app and its associated tests are versioned, but separately.

However, I suspect that the way I'm doing it is not the best way. For example, if I were to create release branches from that 'main' branch, then these release branches would get out of sync with the unit tests, unless I branched those in the same way.

Currently, in order to create a snapshot of the application, I just export all files from that main branch and zip them up, because there is nothing in that branch's tree that isn't part of the app that will get sent to clients.

What would be a better way to do what I'm doing? Should the unit tests go into that same 'main' branch as the app, and if so what is a convenient way to easily create a 'snapshot' ie the equivalent of a 'daily build' which contains only the files that will be distributed with the app?

Thank you all for your answers. It was hard to decide whose answer to accept. The solution I've gone with is to have my tests within a 'tests' subdirectory of my main tree; I could easily strip that out later if I didn't want to distribute the tests.

  • 写回答

3条回答 默认 最新

  • dqc22586 2009-04-27 05:01
    关注

    You definitely want to keep your unit tests and code as close as possible. The process we follow is such:

    libs/Core/Login.php
    libs/Core/Process.php
    libs/Core/t/LoginTest.php
    libs/Core/t/ProcessTest.php
    

    Basically, create a unit testing module for each part of your code, and separate it from the real code by keeping it in a subdirectory. Then have something go through, find all of the unit testing code and run it before you push to production.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP