Jmeter interface flow test

 

Jmeter simple process testing

The complete process: add articles - delete articles

 

The total is as follows:

 

First, the test plan

User-defined variables, I define three variables:

Two, HTTP cookie manager

Fill cookie to be added

三、JDBC Connection Configuration

Connect to the database, add articles after the operation to go to the database to check whether the added successfully. In fact, here you can put the database addresses, user names, passwords are parameterized, written in the test plan, facilitate change.

Fourth, add articles

title for the test plan timestamp variable. It can generally be solved when the time stamp data check is repeated in some systems.

 

Fifth, and finally get a table data, check whether the title is added.

 

Six, beanshell assertion

Jdbc request to add the fifth step beanshell assertion, the same judge queried whether the title of the last data and add.

code show as below:

IF ( "$ {} article_last3_1" the equals ( "SJC $ {}").) 
{ 
	Failure to false =; 
	failureMessage = "test plan timestamp is equal to the last title of the data in the database"; 
	log.error ( "Test Success Program title timestamp equal to the last data in the database "); 
	} 
the else 
{ 
	Failure = to true; 
	failureMessage =" test plan timestamp is not equal to the last header data in the database "; 
	}

  

Seven, delete articles

Eight, delete articles - check remove results

I used two methods:

1, into the database of the most violent: query the database table id last article of data is not just check out the id, or the number of checks article data table, etc.

2、添加响应断言最简单:检查响应文本是否包含success(需先确定删除成功会返回success),或者响应代码匹配200,等等

 

最后再记忆一下,查询article表中最后一条数据:select * from article order by id DESC limit 1;

Guess you like

Origin www.cnblogs.com/youreyebows/p/10968684.html