Postman高级应用(7):我又错哪了——控制台输出

版权声明:本文为@李奕锋 原创文章,如需转载,请注明出处! https://blog.csdn.net/qq598535550/article/details/82711725

场景

我们上两节介绍了Postman的Pre-request Script和Tests,它们都需要写JavaScript代码,说到写代码肯定离不开调试(控制台输出)。Postman为我们提供了一个类似浏览器console的简单控制台面板,可以通过console.log打印一些信息到控制台方便我们验证和调试。

实战

  1. 我们在Pre-request Script下编写一些示例代码,通过console.log输出到控制台。

  2. 打开Postman Console(控制台)。可以通过左下角图标打开,也通过在菜单栏(View -> Show Postman Console)打开。

  3. 发送请求后,我们发现两个测试信息都打在控制台上了,除此之外这次请求的请求和响应详细信息也打在控制台上。它还有过滤功能,方便我们快速查找打印。我们平时在写一些复杂的逻辑时可以多打些输出方便调试,合理利用好控制台能使我们更快定位到错误。

更多内容请阅读《Postman高级应用》专栏

展开阅读全文

这个application又错哪了???

03-17

实现一个复数类:rnpackage ComplexNumber;rnpublic class ComplexNumberrnrn double m_dRealPart,m_dImaginPart;rn ComplexNumber()m_dRealPart=0;m_dImaginPart=0;rn ComplexNumber(double r,double i)m_dRealPart=r;m_dImaginPart=i;rn double getRealPart()return m_dRealPart;rn double getImaginaryPart()return m_dImaginPart;rn void setRealPart(double d)m_dRealPart=d;rn void setImaginaryPart(double d)m_dImaginPart=d;rn ComplexNumber complexAdd(ComplexNumber c)rn m_dRealPart+=c.m_dRealPart;rn m_dImaginPart+=c.m_dImaginPart;rn return this;rn ComplexNumber complexAdd(double c)m_dRealPart+=c;return this;rn ComplexNumber complexMinus(ComplexNumber c)rn m_dRealPart-=c.m_dRealPart;rn m_dImaginPart-=c.m_dImaginPart;rn return this;rn ComplexNumber complexMinus(double c)m_dRealPart-=c;return this;rn ComplexNumber complexMulti(ComplexNumber c)rn m_dRealPart=m_dRealPart*c.m_dRealPart-m_dImaginPart*c.m_dImaginPart;rn m_dImaginPart=m_dRealPart*c.m_dImaginPart+m_dImaginPart*c.m_dRealPart;rn return this;rn ComplexNumber complexMulti(double c)m_dRealPart*=c;return this;rn public String toString()return(m_dRealPart+m_dImaginPart+"i");rn rn//主函数类:rnimport ComplexNumber.ComplexNumber;rnpublic class TestComplexNumberrnrn public static void main(String args[])rn rn double c=5.1;rn ComplexNumber CN1=new ComplexNumber(-2.1,5.3);rn ComplexNumber CN2=new ComplexNumber(3.6,4.7);rn System.out.print("CN1=");rn System.out.println(CN1.toString());rn System.out.print("CN2=");rn System.out.println(CN2.toString());rn CN1.complexAdd(CN2);rn System.out.print("CN1+CN2=");rn System.out.print(CN1.toString());rn CN1.complexAdd(c);rn System.out.print("CN1+"+c+"=");rn System.out.println(CN1.toString());rn CN1.complexMinus(CN2);rn System.out.print("CN1-CN2=");rn System.out.println(CN1.toString());rn CN1.complexMinus(c);rn System.out.print("CN1-"+c+"=");rn System.out.println(CN1.toString());rn CN1.complexMulti(CN2);rn System.out.print("CN1*CN2=");rn System.out.println(CN1.toString());rn CN1.complexMulti(c);rn System.out.print("CN1*"+c+"=");rn System.out.println(CN1.toString());rn rn rn public class ComplexNumberrnrn double m_dRealPart,m_dImaginPart;rn ComplexNumber()m_dRealPart=0;m_dImaginPart=0;rn ComplexNumber(double r,double i)m_dRealPart=r;m_dImaginPart=i;rn double getRealPart()return m_dRealPart;rn double getImaginaryPart()return m_dImaginPart;rn void setRealPart(double d)m_dRealPart=d;rn void setImaginaryPart(double d)m_dImaginPart=d;rn ComplexNumber complexAdd(ComplexNumber c)rn m_dRealPart+=c.m_dRealPart;rn m_dImaginPart+=c.m_dImaginPart;rn return this;rn ComplexNumber complexAdd(double c)m_dRealPart+=c;return this;rn ComplexNumber complexMinus(ComplexNumber c)rn m_dRealPart-=c.m_dRealPart;rn m_dImaginPart-=c.m_dImaginPart;rn return this;rn ComplexNumber complexMinus(double c)m_dRealPart-=c;return this;rn ComplexNumber complexMulti(ComplexNumber c)rn m_dRealPart=m_dRealPart*c.m_dRealPart-m_dImaginPart*c.m_dImaginPart;rn m_dImaginPart=m_dRealPart*c.m_dImaginPart+m_dImaginPart*c.m_dRealPart;rn return this;rn ComplexNumber complexMulti(double c)m_dRealPart*=c;return this;rn public String toString()return(m_dRealPart+m_dImaginPart+"i");rn rn在JDK1.3中编译是通过了,却运行不起来,又出现了一大窜错误提示,有点看不懂,不知错哪了???rn 论坛

没有更多推荐了,返回首页