实施测试和单元测试

发布于 2024-11-06 11:55:28 字数 115 浏览 1 评论 0原文

我只是想知道单元测试和实现测试有什么区别。我知道单元测试是使用定义的输入来测试您的模块/类/对象,并根据某些定义的输出检查结果,但是实现测试的作用是什么以及如何做到这一点?另外,实施测试在开发生命周期中适合什么位置?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

赤濁 2024-11-13 11:55:28

“实施测试”并不是一个常见的表达方式。我怀疑您的意思是“集成测试”,因为它很常用,尤其是与单元测试相比。

集成测试意味着测试一起运行的多个部分或整个系统。通常,测试会模拟实际用户通过常规 UI 使用系统。

优点是,您不仅可以测试每个组件是否履行其合同,还可以测试它们是否正确组成和配置以及是否按预期交互 - 这是单元测试无法捕获的东西。另一方面,通常很难通过集成测试彻底测试边界条件,它们不太稳定并且执行时间更长。当然,在系统的大部分工作正常之前,它们无法运行(甚至写入)。

因此,集成测试在开发生命周期中比单元测试发生得晚得多。

"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.

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.

嘿哥们儿 2024-11-13 11:55:28

我听说过在两种不同的环境中使用实施测试。首先,它可以是对设计的测试。如果您有复杂的逻辑,您可以在将其交给编码员之前逐步完成逻辑 - 这样您就不会浪费时间来实现您应该设计得更好的东西。我还听说它被用作 V&V(验证和验证)的另一个术语,您可以在其中确保您的实施符合您的要求并满足客户的愿景。

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.

怪我闹别瞎闹 2024-11-13 11:55:28

实施可以是 PRE 或 POST。

在这种情况下,实施意味着“投入使用”,即投入生产。

因此,实施前测试意味着在上线之前在预生产中进行测试。
实施后测试意味着一旦上线,就在实时环境中进行测试。

Implementation is either PRE or POST.

In this case, implementation means "Putting live" I.e. - 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.

凹づ凸ル 2024-11-13 11:55:28

我使用 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);
        }
    }          
}

I worked with Visual Studio Testing Tools, Testdriven.net and Excel, all of them together very good solution, I wrote this unit test

[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);
        }
    }          
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文