Use postman mock server

Need to write a small Java program used to call interface cloud platform

As the cloud platform interface program has not been written, only a simulation approach previously developed code

Use the post to simulate the interface program.

Need to simulate the following interfaces:

■ request address
/openapi/ipm/wait/process/query

■ request parameters
no

■ return data sample
{
	"code": 200,
	"Msg": "Request success"
	"data": [{
			"aluGrade": 1100,
			"aluState": H24,
			"thickness": 2.10,
			"width": 1200,
			"aluGrade": 1100,
			"length": 3000,
			"isFilm": 0,
			"cnt": 10, "id": 10,
		},
		{
			"aluGrade": 1100,
			"aluState": H24,
			"thickness": 2.10,
			"width": 1200,
			"aluGrade": 1100,
			"length": 3000,
			"isFilm": 0,
			"cnt": 10, "id": 10,
		}
	]
}

 

1. Open the postman program, select New-> Mock Server

 

 

 

 

 

 

2. Configure collection

Fill in the Request Path in the path, remember not to write more than a slash.

openapi/ipm/wait/process/query

  

Response Body analog data in the write to be returned

{
	"code": 200,
	"Msg": "Request success"
	"data": [{
			"aluGrade": 1100,
			"aluState": H24,
			"thickness": 2.10,
			"width": 1200,
			"aluGrade": 1100,
			"length": 3000,
			"isFilm": 0,
			"cnt": 10, "id": 10,
		},
		{
			"aluGrade": 1100,
			"aluState": H24,
			"thickness": 2.10,
			"width": 1200,
			"aluGrade": 1100,
			"length": 3000,
			"isFilm": 0,
			"cnt": 10, "id": 10,
		}
	]
}

  

 

 

 

Select Next, himself a top name in Mock Server.

I remember the [Save to the mock server URL as an environment variable] hook,

postman will help you address this mock server generates an environment back at the time of the test will be used in this environment.

 

 

 

After configuration is complete, the end.

 

 

 

 

After configuration is complete, postman will generate a mock server's address

For example, here is generated address

https://3dd39ca6-40bd-41ae-a045-ff80d0e6aca8.mock.pstmn.io

  

 

 

 

3. Start Mock Server

Click the Run button in the screen, enter the starting page Collection

 

 

 

 Start complete

 

 

4. The transmission request through the browser, whether authentication is successful

 

Guess you like

Origin www.cnblogs.com/quchunhui/p/11881185.html