# Request Setup()

Since we are simulating a browser, the testing framework needs to know when to prepare a new virtual request internally.  This is achieved via the `setup()` method provided to us via the `BaseTestCase` object.  This method internally will simulate a new virtual request, if **NOT**, **every test case will be treated as if you are in the same request.**

The best way to accomplish this is to leverage the `beforeEach()` life-cycle event method.  This makes sure that each spec execution is a new virtual request.

```javascript
function run() {
	describe( "Main Handler", function() {
		
		beforeEach( function( currentSpec ) {
			// Setup as a new ColdBox request, VERY IMPORTANT. ELSE EVERYTHING LOOKS LIKE THE SAME REQUEST.
			setup();
		} );
	
		it( "can render the homepage", function() {
			var event = this.get( "main.index" );
			expect( event.getValue( name = "welcomemessage", private = true ) ).toBe( "Welcome to ColdBox!" );
		} );
	
		it( "can render some restful data", function() {
			var event = this.post( "main.data" );
	
			debug( event.getHandlerResults() );
			expect( event.getRenderedContent() ).toBeJSON();
		} );
	});
	
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coldbox.ortusbooks.com/v6.x/testing/testing-coldbox-applications/integration-testing/test-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
