简体   繁体   English

实施测试和单元测试

[英]Implementation testing and unit testing

I just wondered what the differences with unit testing and implementation testing are. 我只是想知道单元测试和实施测试之间的区别。 I know unit testing is testing your modules/class/objects using defined inputs and checking the results against some defined outputs but what does implementation testing do and how do you do it? 我知道单元测试是使用定义的输入来测试模块/类/对象,并根据一些定义的输出来检查结果,但是实现测试有什么作用,您该怎么做? Also where does implementation testing fit in the development lifecycle? 在开发生命周期中,实施测试还​​适合什么地方?

"implementation testing" is not a common expression. “实施测试”不是常见的表达方式。 I suspect that you meant "integration testing", since that is commonly used, especially in contrast to unit testing. 我怀疑您的意思是“集成测试”,因为它是常用的,尤其是与单元测试相反。

Integration testing means testing multiple parts or all of the system acting together. 集成测试是指测试多个部分或整个系统一起运行。 Often, the tests simulate an actual user working with the system through its regular UI. 通常,这些测试会模拟实际用户通过其常规UI使用该系统。

The advantage is that you don't just test whether each component fulfils its contract, but also whether they are composed and configured correctly and interact as expected - things that you can't catch with unit tests. 这样做的好处是,您不仅可以测试每个组件是否履行其合同,而且还可以测试它们是否正确组成和配置以及是否按预期的方式进行交互-这是单元测试所无法捕捉的。 On the other hand, it's often hard to exhaustively test boundary conditions with integration tests, they're less stable and take much longer to execute. 另一方面,通常很难用集成测试来详尽地测试边界条件,它们的稳定性较差,执行时间要长得多。 And of course they cannot be run (or even written) until most of the system is working. 当然,在大多数系统正常工作之前,它们无法运行(甚至无法编写)。

Thus, integration tests happen much later in the development lifecycle than unit tests. 因此,集成测试发生在开发生命周期中比单元测试晚得多。

I've heard implementation testing used in two different contexts. 我听说过在两种不同情况下使用过实施测试。 First, it can be a test of the design. 首先,它可以测试设计。 If you've got complex logic, you step through the logic before you hand it off to a coder - that way you don't waste time implementing something that you should have designed better. 如果您有复杂的逻辑,则在将逻辑移交给编码器之前,请先遍历逻辑-这样一来,您就不会浪费时间来实现应该设计得更好的东西。 I've also heard it used as another term for V&V (validation and verification), where you make sure your implementation matches your requirements and that it meets the customer's vision. 我也听说过它用作V&V(验证和验证)的另一个术语,您可以在其中确保实现符合您的要求并满足客户的期望。

Implementation is either PRE or POST. 实现是PRE或POST。

In this case, implementation means "Putting live" Ie - Into Production. 在这种情况下,实施的意思是“投入生产”,即投入生产。

So pre-implementation testing means testing in pre-prod just before live. 因此,实施前测试意味着在上线之前进行预产品测试。 Post-implementation testing means testing in live environment, once it has gone live. 实施后测试意味着一旦投入使用,便要在实时环境中进行测试。

I worked with Visual Studio Testing Tools, Testdriven.net and Excel, all of them together very good solution, I wrote this unit test 我使用了Visual Studio测试工具,Testdriven.net和Excel,它们都一起很好地解决了问题,我编写了此单元测试

[TestMethod()]
public void viewFolderTest()  
{
    string Err = "";
    connect_Excel("viewFolderTest");            
    DcDms actual;
    DaDoc target = new DaDoc(); 

    for (int i = 10; i < ds.Tables[0].Rows.Count; i++)
    {
        Err = "";

        TestRow = ds.Tables[0].Rows[i]["Row"].ToString();
        string expected = ds.Tables[0].Rows[i]["expected"].ToString();
        string ParentId = ds.Tables[0].Rows[i]["ParentId"].ToString(); 

        actual = target.viewFolder(ParentId);

        try
        {
            Assert.AreEqual(expected,actual.Tables[DcDms.Dms_vrFileFolder].Rows.Count.ToString());
        }
        catch (System.Exception ex)
        {
            Err = ex.Message;
            if (Err.Length >= 254)
            {
                Err = Err.Substring(0, 255);   
            }
            Update_Excel("viewFolderTest", "ERROR", Err, "Row", TestRow);
        }
        Update_Excel("viewFolderTest", "actual", actual.Tables[DcDms.Dms_vrFileFolder].Rows.Count.ToString(), "Row", TestRow);
        if (Err == "")
        {
            Update_Excel("viewFolderTest", "ERROR", "Pass", "Row", TestRow);
        }
    }          
}

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

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