<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.liberty-eiffel.org/index.php?action=history&amp;feed=atom&amp;title=Mock</id>
	<title>Mock - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.liberty-eiffel.org/index.php?action=history&amp;feed=atom&amp;title=Mock"/>
	<link rel="alternate" type="text/html" href="https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;action=history"/>
	<updated>2026-05-04T05:19:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2502&amp;oldid=prev</id>
		<title>Dkearns: s/LibertyEiffel/Liberty Eiffel/</title>
		<link rel="alternate" type="text/html" href="https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2502&amp;oldid=prev"/>
		<updated>2016-06-22T01:53:26Z</updated>

		<summary type="html">&lt;p&gt;s/LibertyEiffel/Liberty Eiffel/&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:53, 22 June 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;While testing, it is frequently useful to be able to isolate the component being tested, and making it interact with &quot;fake&quot; objects, known as ''mocks'' in the Object-Oriented literature.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;While testing, it is frequently useful to be able to isolate the component being tested, and making it interact with &quot;fake&quot; objects, known as ''mocks'' in the Object-Oriented literature.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;−&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;LibertyEiffel&lt;/del&gt;'s mock implementation is quite straightforward: it takes a class to mock, and produce two classes: the mock implementation, and a test driver.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Liberty Eiffel&lt;/ins&gt;'s mock implementation is quite straightforward: it takes a class to mock, and produce two classes: the mock implementation, and a test driver.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Instances of the mock implementation class will be used to interact with the component being tested.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Instances of the mock implementation class will be used to interact with the component being tested.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[library_class:EIFFELTEST_TOOLS|&amp;lt;tt&amp;gt;EIFFELTEST_TOOLS&amp;lt;/tt&amp;gt;]] contains a feature ''scenario'', used to prepare the test scenario using mocks&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[library_class:EIFFELTEST_TOOLS|&amp;lt;tt&amp;gt;EIFFELTEST_TOOLS&amp;lt;/tt&amp;gt;]] contains a feature ''scenario'', used to prepare the test scenario using mocks&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;−&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is an example of such a usage in the &amp;lt;TT&amp;gt;test/tools/mocker&amp;lt;/TT&amp;gt; directory in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;LibertyEiffel&lt;/del&gt; source tree.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is an example of such a usage in the &amp;lt;TT&amp;gt;test/tools/mocker&amp;lt;/TT&amp;gt; directory in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Liberty Eiffel&lt;/ins&gt; source tree.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dkearns</name></author>
	</entry>
	<entry>
		<id>https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2263&amp;oldid=prev</id>
		<title>Ramack: /* Using eiffeltest */ fixed interwiki link</title>
		<link rel="alternate" type="text/html" href="https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2263&amp;oldid=prev"/>
		<updated>2016-05-02T19:30:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Using eiffeltest: &lt;/span&gt; fixed interwiki link&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:30, 2 May 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 43:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 43:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''.mock'' files are read by [[eiffeltest]]. Each line must be a file name of a class to mock. Eiffeltest will call ''mock'' on each class.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* ''.mock'' files are read by [[eiffeltest]]. Each line must be a file name of a class to mock. Eiffeltest will call ''mock'' on each class.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;−&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[EIFFELTEST_TOOLS]] contains a feature ''scenario'', used to prepare the test scenario using mocks&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;+&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;library_class:&lt;/ins&gt;EIFFELTEST_TOOLS&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|&amp;lt;tt&amp;gt;EIFFELTEST_TOOLS&amp;lt;/tt&amp;gt;&lt;/ins&gt;]] contains a feature ''scenario'', used to prepare the test scenario using mocks&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is an example of such a usage in the &amp;lt;TT&amp;gt;test/tools/mocker&amp;lt;/TT&amp;gt; directory in LibertyEiffel source tree.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&amp;#160;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is an example of such a usage in the &amp;lt;TT&amp;gt;test/tools/mocker&amp;lt;/TT&amp;gt; directory in LibertyEiffel source tree.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ramack</name></author>
	</entry>
	<entry>
		<id>https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2259&amp;oldid=prev</id>
		<title>Cadrian: Created page with &quot;== Introduction ==  While testing, it is frequently useful to be able to isolate the component being tested, and making it interact with &quot;fake&quot; objects, known as ''mocks'' in ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.liberty-eiffel.org/index.php?title=Mock&amp;diff=2259&amp;oldid=prev"/>
		<updated>2016-05-01T20:02:59Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Introduction ==  While testing, it is frequently useful to be able to isolate the component being tested, and making it interact with &amp;quot;fake&amp;quot; objects, known as &amp;#039;&amp;#039;mocks&amp;#039;&amp;#039; in ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
While testing, it is frequently useful to be able to isolate the component being tested, and making it interact with &amp;quot;fake&amp;quot; objects, known as ''mocks'' in the Object-Oriented literature.&lt;br /&gt;
&lt;br /&gt;
LibertyEiffel's mock implementation is quite straightforward: it takes a class to mock, and produce two classes: the mock implementation, and a test driver.&lt;br /&gt;
&lt;br /&gt;
* Instances of the mock implementation class will be used to interact with the component being tested.&lt;br /&gt;
* Instances of the test driver class will be used by the test scenario to &amp;quot;prepare&amp;quot; the behavior of the mock implementation instances.&lt;br /&gt;
&lt;br /&gt;
There is only one requirement: the class to be mocked must be deferred.&lt;br /&gt;
&lt;br /&gt;
[[eiffeltest]] is also able to automatically generate mocks.&lt;br /&gt;
&lt;br /&gt;
== Calling ''mock'' directly ==&lt;br /&gt;
&lt;br /&gt;
The tool takes one parameter: the name of the class to mock, which must be deferred. It generates two classes:&lt;br /&gt;
&lt;br /&gt;
* the _MOCK class, which is the implementation of the class to mock;&lt;br /&gt;
* the _EXPECT class, which is the test driver, used in test scenarios.&lt;br /&gt;
&lt;br /&gt;
There are options to change the name of the generated classes.&lt;br /&gt;
&lt;br /&gt;
== Using the test driver ==&lt;br /&gt;
&lt;br /&gt;
The test driver, or ''expect class'', allows to prepare the behavior of the mock instance.&lt;br /&gt;
&lt;br /&gt;
When the tester creates an ''expect'' instance, a ''mock'' instance is created by the test driver. It is available using the ''mock'' feature.&lt;br /&gt;
&lt;br /&gt;
For each deferred feature of the class to mock, the test driver exposes:&lt;br /&gt;
&lt;br /&gt;
* A feature with the same name, that takes the same arguments as the original function, and returns an expectation object (more on that below);&lt;br /&gt;
* A feature with the same name and a ''__match'' suffix, only if the original feature takes arguments. In that case, the arguments are matchers, thus allowing a greater liberty on how to match arguments. The feature also returns an expectation object.&lt;br /&gt;
&lt;br /&gt;
The expectation object is used when the corresponding feature is called on the mock object (presumably by the component being tested). When building the test scenario, the expectation object is used to tune how the mock object behaves when the feature is called:&lt;br /&gt;
&lt;br /&gt;
* What object to return (if it is a function)&lt;br /&gt;
* If a function must be called as side-effect&lt;br /&gt;
* The number of times the feature is expected to be called&lt;br /&gt;
&lt;br /&gt;
== Using eiffeltest ==&lt;br /&gt;
&lt;br /&gt;
Eiffeltest brings the following features:&lt;br /&gt;
&lt;br /&gt;
* ''.mock'' files are read by [[eiffeltest]]. Each line must be a file name of a class to mock. Eiffeltest will call ''mock'' on each class.&lt;br /&gt;
* [[EIFFELTEST_TOOLS]] contains a feature ''scenario'', used to prepare the test scenario using mocks&lt;br /&gt;
&lt;br /&gt;
There is an example of such a usage in the &amp;lt;TT&amp;gt;test/tools/mocker&amp;lt;/TT&amp;gt; directory in LibertyEiffel source tree.&lt;/div&gt;</summary>
		<author><name>Cadrian</name></author>
	</entry>
</feed>