
Resources.FitNesseRoot.FitNesse.UserGuide.FixtureGallery.BasicFitFixtures.ActionFixture.content.txt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
''Previous page: [[!-ColumnFixture-!][ -!!- -!'''!- check -!'''!- — executes a method and verifies its value. -!!- -!!- -!'''!- press -!'''!- — executes a -!'''!- void -!'''!- method without testing anything. -!!- -!!- -!'''!- enter -!'''!- — executes a method and passes an argument to it. -!!- -!!- -!!- You can imagine an -!'''!- ActionFixture -!'''!- as an automation tool to populate UI forms and click on buttons that are connected to methods. -!
{{{
!-!-!|ActionFixture|
|start|ActionFixtureTest|
|enter|firstPart|Hello|
|enter|secondPart|World|
|press|join|
|check|together|Hello, World|
}}}
# section Fixture class
!3 !-Fixture class-!
!- An important difference between -!'''!- ActionFixture -!'''!- and all other fixtures is that you should not extend the -!'''!- ActionFixture -!'''!- class in order to use it. Instead, you should extend the -!'''!- fit.Fixture -!'''!- class directly for your fixture and then pass it on to the -!'''!- ActionFixture -!'''!- using the -!'''!- start -!'''!- command. -!
# section Java Source Code
!3 !-Java Source Code-!
{{{
package info.fitnesse.fixturegallery;
public class ActionFixtureTest extends fit.Fixture{
private String first, second, both;
public void firstPart(String s){
first=s;
}
public void secondPart(String s){
second=s;
}
public void join(){
both=first+ ", "+second;
}
public String together(){
return both;
}
}
}}}
# section .NET Source Code
!3 !-.NET Source Code-!
{{{
using System;
namespace info.fitnesse.fixturegallery
{
public class ActionFixtureTest: fit.Fixture
{
public String firstPart, secondPart, together;
public void join()
{
together=firstPart+ ", "+secondPart;
}
}
}
}}}
# section Python Source Code
!3 !-Python Source Code-!
{{{
from fit.Fixture import Fixture
class ActionFixtureTest(Fixture):
_typeDict = {}
def __init__(self):
Fixture.__init__(self)
self.__first = "" #< Private attributes (Python convention).
self.__second = ""
self.__both = ""
# JAVA: void firstPart(String s)
_typeDict["firstPart"] = "String"
def firstPart(self, s):
self.__first = s
# JAVA: void secondPart(String s)
_typeDict["secondPart"] = "String"
def secondPart(self, s):
self.__second = s
# JAVA: void join()
_typeDict["join"] = "Default" #< AUTO-DETECT: None = void
def join(self):
self.__both = "%s, %s" % (self.__first, self.__second)
# JAVA: String together()
_typeDict["together"] = "String"
def together(self):
return self.__both
}}}
# section Notes
!3 !-Notes-!
!- In the Java version, -!'''!- ActionFixture -!'''!- only works on methods. in the .NET version, -!'''!- enter -!'''!- and -!'''!- check -!'''!- can get and set fields and properties as well. -!
# section Usage
!3 !-Usage-!
!-You can use the -!'''!- ActionFixture -!'''!- to describe UI-style verifications.-!
!- In general, -!'''!- ActionFixture -!'''!- has been replaced by -!'''!- DoFixture -!'''!- (see -![[!-DoFixture-!][
© 2015 - 2025 Weber Informatics LLC | Privacy Policy