понедельник, 16 июня 2014 г.

Automated testing in SAP Portal

If you want to test you web application or web-service, you can use JUnitEE to make automated testing.

- create you application, and java classes in there

- create WebModule Project and EAR project for that

- create External Library project and add there junit.jar and junitee.jar

- add dependency from WebModule and EAR project to external library project. After that you can use JUnit API in your WebModule project

- create Java Class in WebModule project and extend it from abstract class junit.framework.TestCase

- create methods in that class to make tests and write everything like it is simple JUnit test

- in WebModule project in folder WEB-INF edit or create if not exist web.xml file

- in that file write this:

  <servlet>
      <servlet-name>UnitTestServlet</servlet-name>
      <servlet-class>org.junitee.servlet.JUnitEEServlet</servlet-class>
  </servlet>

  <servlet-mapping>
      <servlet-name>UnitTestServlet</servlet-name>
      <url-pattern>/UnitTestServlet/*</url-pattern>
  </servlet-mapping>

- in folder WEB-INF create file with name "testCase.txt" and write in that file full class name which contains your tests (which extended from junit.framework.TestCase)

- deploy EAR and external library project on your AS 

- use link  <host>:<port>/<vendor>~<WebModule project name>/UnitTestServlet to see your tests. For example if vendor name is demo.sap.com and WebModule project name is junit/frmw than url will be:  <host>:<port>/demo.sap.com~junit~frmw/UnitTestServlet

Комментариев нет:

Отправить комментарий