# UsebeanTest

### Summary

The useBean action is used to instantiate a Bean which can be retrieved.

### Positive Tests

positiveBodyNew Test: Try to create a valid useBean tag in the JSP page with a non-empty body. Ensure that the classname specified does not exist.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveBodyNew -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveNoBody Test: Try to create a valid useBean tag in the JSP page with no body.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveNoBody -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveBodyExists Test: Try to create a valid useBean tag in the JSP page with a non-empty body and with a class name that has already been created.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveBodyExists -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveDupIDRequest Test: Try to create two useBean tags on different JSP pages with same ID, but with scope attribute being set to "request".

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveDupIDRequest -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveSessionScope Test: Create the JSP page with useBean scope set to "session". Load the CounterBean. Try to reload the page multiple times.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveSessionScope -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveDupIDPage Test: Try to create two useBean tags on different JSP pages with the same ID, with the scope attribute of each being set to "page". Thereafter Access each page one after the other.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveDupIDPage -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positivePageScope Test: Create the JSP page with useBean scope set to "page". Load the CounterBean. Try to reload the page multiple times.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positivePageScope -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveTypeAssignable we are using 'class' and 'type' together and 'class' is assignable to type. This should return the expected page without error.

title | UsebeanTest
source | UsebeanTest.java Counter.java NewCounter.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveTypeAssignable -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveBeanNameClass Declaring the bean with bean name as the class file. We should get the page output without error.

title | UsebeanTest
source | UsebeanTest.java Counter.java NewCounter.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveBeanNameClass -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

positiveBeanNameClass Declaring the bean with bean name as the resource file. We should get page output without error.

title | UsebeanTest
source | UsebeanTest.java Counter.java NewCounter.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID positiveBeanNameRes -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

### Negative Tests

negativeDupIDSession Test: Try to create two useBean tags on different JSP pages with same ID, but with scope attribute being set to "session"

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeDupIDSession -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeInvalidClass Test: Try to create a JSP with useBean tag that contains a non-implicit class reference and no source file for that class.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeInvalidClass -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeDupID Test: Try to create two useBean tags in the same JSP page with the same ID.

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeDupID -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeBody Test: Try to create an invalid useBean tag with body (i.e. the tag has a body, but the closing tag does not exist)

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeBody -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeNoBody Test: Try to create an invalid useBean tag (i.e. tag that is not closed)

title | UsebeanTest
source | UsebeanTest.java Counter.java String_IntBean.java IntBean.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeNoBody -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI

negativeTypeNonAssignable We are using 'class' and 'type' together and 'class' is not assignable to type. This should return ClassCastException.

title | UsebeanTest
source | UsebeanTest.java Counter.java NewCounter.java
executeClass | core_syntax.beantests.useBean.UsebeanTest
executeArgs | -TestCaseID negativeTypeNonAssignable -ServerHost $servletServerHost -ServerPort $servletServerPort -UrlMaps $servletMaps
keywords | positive extensionAPI