Skip to content
ckeiner edited this page Jul 24, 2018 · 3 revisions

This guide will help you to get the test suite up and running in Eclipse.

Requirements

All requirements are listed in Requirements.

  1. Download the testsuite

    Go to the folder where you want to have the test suite and use git clone git@github.com:Xceptance/testsuite-nocoding.git.

    Alternatively download the test suite as .zip: Click for Download

  2. Import "testsuite-nocoding" as an existing project:

    Eclipse:

    • Menu Bar --> File --> Import... --> Existing Maven Projects
    • Browse to the test suite and select "/pom.xml com.xceptance:testsuite-nocoding:x.x.x:jar" --> Click Finish

Now we want to start our sample web server, which runs the website. We use the "posters" app server, which is shipped together with XLT, which you can download here.

  • Start The Server

  • Navigate to: <XLT>/samples/app-server/bin.

  • Start the app server by using ./start.sh or ./start.cmd depending on your environment.

  • Check if the app server is running:

  • Open a webbrowser

  • Open the URL: https://localhost:8443/posters/

The website should look like this:

Posters


Now we want to make sure, that everything is correctly set up:

  • Open the testsuite-nocoding project with your IDE.
  • Navigate to the Test Class Folder:

testsuite-nocoding/src/posters.tests.nocoding

  • Run the Class "TLLogin.java" as JUnit Test.

    Right Click onto the class TLLogin.java --> Run as --> JUnit Test

This starts a test run.

If everything is correctly set up, the green JUnit success-bar should appear.

Green JUnit bar


Now, that everything is correctly set up, we want to write a custom test case.

At first, we want a test case, that simply opens the website of the posters shop.

We proceed in the following steps:

  1. Define the test case
  2. Configure the test case
  3. Run the test case

We have two choices on where to define the test case. You can either use testsuite-nocoding/config/data or the classpath. For now, let's stick to testsuite-nocoding/config/data. There, we create a new file called:

hellosuite.yml

This file will contain the test definition for our test case. We insert the following lines into the file:

- Action :
    Name : Hello Site
    Request :
        Url : https://localhost:8443/posters/

This creates an XLT Action, which is named like the value mapped to the Name tag. This is primarily used to display the result as well as displaying it in an error message when something goes wrong. Each Action contains a HTTP request, which request the resource located at the value mapped to the Url tag under request. Therefore, an XLT Action with the Name Hello Site is created and a HTTP GET Request for the URL https://localhost:8443/posters/ is sent. More details on the library's syntax can be found in the YAML Section.

Now, save the file.


Note:

Since this is YAML, take care to use whitespace characters only and no tabs! Further information can be found here.


Next we have to configure the test case.

  • Create A Wrapper Class

    First, we create a wrapper class for the test file. This is not mandatory, but convenient, since it enables us to execute the test case by simply executing the wrapper class.

    Therefore, we create a new class in the package posters.tests.nocoding, called:

    HelloSuite.java and insert the following lines:

    package posters.tests.nocoding;
    
    import com.xceptance.xlt.nocoding.api.AbstractNocodingTestCase;
    
    public class HelloSuite extends AbstractNocodingTestCase
    {
    
    }

    HelloSuite.java extends AbstractNocodingTestCase.java, which is the base class for all test cases.

  • Define A Test Case

    Next we have to define a test case and tell the wrapper class its input, which is the file HelloSuite.yml. This is done in the project.properties file:

  • Open testsuite-nocoding/config/project.properties

  • Browse to the section: "Test Case Mapping"

  • Insert the following line:

    com.xceptance.xlt.loadtests.HelloSuite.class = posters.tests.nocoding.HelloSuite

    This creates a test case with the name "HelloSuite", which is referenced to the class HelloSuite.class.

  • Reference the file

    Now we have to link the test case with the test definition file. For this, we add the following lines to the testsuite-nocoding/config/project.properties.

    #########################################################################
    #
    # Test Case: HelloSuite
    #
    #########################################################################
    
    HelloSuite.com.xceptance.xlt.nocoding.filename = hellosuite.yml

    The block of hash symbols isn't necessary but can be helpful in quickly finding your mappings.

    Now you can close the project.properties.

Run the Class HelloSuite.java as JUnit Test.

  • Right click onto the class HelloSuite.java
  • Run as --> JUnit Test

If everything went right, the result of this test run should be visible under:

testsuite-nocoding/results/HelloSuites.html

With this knowledge, you should now be able to set up your own test cases.

Clone this wiki locally