惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - 一一九九

Introduce to MEF (Study)- one 【wpf】AnimatedTabControl 如何显示内容 [wpf]设置Application的ICO Error: does not contain a static 'Main' method suitable for an entry point [wpf] Can you outline a story-driven process with Concordion? Your First Concordion.Net Project (Part 4)-More Specifications! Your First Concordion.Net Project (Part 3)-Adding Specifications Your First Concordion.Net Project (Part 2)-Setting Up Visual Studio Your First Concordion.NET Project (Part 1)-What is Concordion.Net? [Specification by Example][ch5 Deriving scope from goals]-[读书笔记]-[4] [Specification by Example][ch5 Deriving scope from goals]-[读书笔记]-[3] [Specification by Example][ch5 Deriving scope from goals]-[读书笔记]-[2] [Specification by Example][ch5 Deriving scope from goals]-[读书笔记]-[1] [Specification by Example][ch4 Initiation the changes]-[读书笔记] [Specification by Example][ch3 Living documentation]-[读书笔记] [Specification by Example][ch2 key process patterns]-[读书笔记] [Specification by Example][ch1 key benefits]-[读书笔记] Binding Resource
Your First Concordion.Net Project (Part 5)-Running Specs with Gallio
一一九九 · 2012-01-16 · via 博客园 - 一一九九

2012-01-16 17:23  一一九九  阅读(286)  评论()    收藏  举报

http://living-in-concordion.blogspot.com/2009/05/your-first-concordionnet-project-part-5.html

需要一些自动运行Spec的Runner,这里采用的为Gallio写的一个插件。

Gallio是一个开源的测试框架,能够运行各种.net的测试框架,具有较高的扩展能力和丰富的报表系统

那么为了让Gallio能够运行我们的Spec,我们需要编写一个插件。在Concordion的发布文件中,你会看到一个目录叫做Gallio.ConcorionAdaper.这个微微Gallio编写的插件。

我喜欢在运行Spec的时候以Gallio.Echo的方式开始。这是一个可执行文件,而且很容易调试问题。Gallio还有GUI的runner,比如Lcarus.

我们在Specification项目的根目录下创建Specification文件,如下图所示:
Calculator.Sample.11_thumb[1]

这个文件叫做run-spec-with-echo.cmd。我们需要告诉Gallio到哪里找Gallio.ConcordionAdapter插件,以及到哪里找我们的Specification Assembly. 文件夹的内容如下:

Calculator.Sample.12_thumb[1]

在命令行中添加如下命令来告诉Gallio到哪里找目录:/pd:c:\Concordion\Gallio.ConcordionAdapter , 这会使Gallio在这个目录中搜索.plugin文件。然后我们需要告诉Concordion 哪里找到我们的Specification  assembly。bin\Debug\Calculator.Spec.dll。 既然批处理文件是在我们的项目目录中,但是我们的Spec程序集是在项目的输出目录中,我们需要添加到Spec的相对路径。除非明确的执行,Gallio.Echo的路径也是在当前目录下:我们的命令行应该如下所示:

set GALLIO_PATH=C:\Dev\concordion-net\tools\Gallio-trunk\bin
 
%GALLIO_PATH%\Gallio.Echo.exe /pd:c:\Concordion\Gallio.ConcordionAdapter bin\debug\Calculator.Spec.dll
 
pause

运行这个文件,你可能会遇到如下的输出结果:

Calculator.Sample.13_thumb[3]

Fixing the Fixture


修改我们的Calculator Class如下所示:

   1:  public class Calculator
   2:  {
   3:      public long Add(long first, long second)
   4:      {
   5:          return first + second;
   6:      }
   7:   
   8:      public long Subtract(long first, long second)
   9:      {
  10:          return first - second;
  11:      }
  12:   
  13:      public long Multiply(long first, long second)
  14:      {
  15:          return first * second;
  16:      }
  17:   
  18:      public long Divide(long first, long second)
  19:      {
  20:          return first / second;
  21:      }
  22:  }

修改我们的测试代码如下所示:

  [ConcordionTest]
  public class ArithmeticTest
  {
      public long firstOperand;
      public long secondOperand;

      public long Addition(long first, long second)
      {
          return new Calculator().Add(first, second);
      }

      public long Subtraction(long first, long second)
      {
          return new Calculator().Subtract(first, second);
      }

      public long Multiplication(long first, long second)
      {
          return new Calculator().Multiply(first, second);
      }

      public long Division(long first, long second)
      {
          return new Calculator().Divide(first, second);
      }
  }

再次运行后,运行结果如下所示:

image_thumb[2]

最终的HTML的输出结果如下所示:

image_thumb[4]

If you want to see the source code for this series of posts you can download it here.

This sample was pretty basic but it should be enough to get you up and running!

Thanks for trying out this tool, I hope you enjoy it. Stay tuned, there will be more to come on advanced features of Concordion!