Having the output of a console application in Visual Studio instead of the console

前端 未结 12 767
醉话见心
醉话见心 2020-11-29 00:06

When doing a console application in Java with Eclipse, I see the output being put in a text box in the IDE itself, instead of having a console popping up like in Visual Stud

12条回答
  •  有刺的猬
    2020-11-29 00:29

    Instead, you can collect the output in a test result.

    You can't supply input, but you can easily provide several tests with different command line arguments, each test collecting the output.

    If your goal is debugging, this is a low effort way of offering a repeatable debugging scenario.

    namespace Commandline.Test
    {
        using Microsoft.VisualStudio.TestTools.UnitTesting;
    
        [TestClass]
        public class CommandlineTests
        {
            [TestMethod]
            public void RunNoArguments()
            {
                Commandline.Program.Main(new string[0]);
            }
        }
    }
    

提交回复
热议问题