Automated testing tool——Fitnesse

1 Introduction

Is a fully integrated standalone wiki and acceptance testing framework.

1.1. Collaboration tools

Since FitNesse is a wiki web server, it has a very low entry and learning curve, making it an excellent tool for collaboration with business stakeholders.

1.2. Testing tools

A wiki page created in FitNesse is run as a test. Specifications can be tested against the application itself, resulting in back-and-forth between specifications and implementations.

1.3. It is open source

FitNesse is an open source project. The code base is not owned by any company. The FitNesse community shares a lot of information. It is very adaptable and is used in areas ranging from Web/GUI testing to electronic component testing.

2 downloads

Download jar package

Go to the official website to download the latest version

​www.fitnesse.org/FitNesseDow…​

3 start

Enter the command on the command line to start the service

Without any parameters, the default port 8001 is used

java -jar fitnesse-standalone.jar

Specify port

java -jar fitnesse-standalone.jar -p 8080

Enter the URL in the browser and open the page

​http://localhost:8080/​

4 Use case DEMO

4.1. Create JAVA classes locally

package com.auto;

public class Calculator{
	private int first;
	private int second;
	
	public void setFirst(int first){
		this.first = first;
	}
	
	public void setSecond(int second){
		this.second = second;
	}
	
	public int add(){
		return this.first + this.second;
	}
	
	public int minus(){
		return this.first - this.second;
	}
	
	public int multi(){
		return this.first * this.second;
	}
	
	public int div(){
		return this.first / this.second;
	}
}

4.2. Compile into class file

And create the corresponding directory according to the package path, and place the class file in the directory

javac Calculator.java

4.3. Create test set

Enter the test set name suite2 and save it.

4.4. Create test cases

4.4.1 Enter the test set

The browser address cannot automatically jump to the created test set. You need to manually enter the access address:

Just add the test set name after the current address.

4.4.2 Add test cases

Enter the use case name and use case content

The use case content is explained as follows:

!define TEST_SYSTEM {slim}

!path D:\011_automation tool

!|com.auto.Calculator|

|first|second|add?|minus?|multi?|div?|

|12|5|17|7|60|2|

|7|4|11|3|28|1|

  • The first line indicates that FitNesse uses the SLIM test system
  • The second line defines the path where the test code Class file is located. In this example, the Java class file is saved in D:\011_Automation Tools
  • The third line of the package and class name of the class file
  • The fourth line begins the specific test content part:

The fourth line is the header, corresponding to the field name and method name.

The first two columns first|second are the field names in class.

add|minus|multi|div corresponds to the method name in class,

Adding a question after the method name indicates that an assertion needs to be made here to see whether the actual results are consistent with the expected results given in the table.

The fifth line is field assignment and the expected result of the corresponding method.

4.5. Execute test set

After creating the use case, you will return to the test set page

Click [Suite] to execute the test set

The execution results are as follows

4.6. Execute test cases

You can also click on the test case on the test set page

Go to the test case page

Click the [Test] button to execute the test case

Guess you like

Origin blog.csdn.net/QQ156881887/article/details/131610516