Print

Introduction to test debugging in JOSF

Introduction

Testing and debugging are crucial aspects of any software development process. In the realm of automated testing, tools like JOSF offer powerful features that simplify these tasks. In this tutorial, we’ll delve into the process of creating and debugging tests within JOSF, providing you with practical insights and tips to enhance your testing workflow.

Getting Started with JOSF

Before diving into the wonder world of test creation and debugging, it’s essential to have a basic understanding of JOSF. If you’re new to this tool, we highly recommend checking out the introductory video, “How to Get Started with JOSF.” It covers the foundational concepts and steps for setting up your first test. Once you’re familiar with the basics, you’re ready to explore more features and techniques for creating and debugging tests.


Assembling a Test

Creating a test in JOSF is a straightforward process, with multiple methods available to add and organize test steps:

  1. You can easily add steps to your test by dragging them from the right drawer and dropping them into your test script.
  2. Another quick method is to double-click on a step. This action will automatically add the step to the bottom of your script or directly beneath the currently selected step. If the opened step is a group, it will be placed at the end of that group.

Adjusting the execution sequence can be done by rearranging the steps:

To move a step’s position, drag a step to a new position within the test by hovering over the step and drag with the 6 dots icon.


The edit mode

JOSF provides a robust editing mode that allows you to modify your test steps efficiently. To alter your dragged in steps you can right-click on any step to see the additional options:

  1. Run Script Until Here: Executes the test up to and including this step.
  2. Duplicate Step: Copies the step with its data and/or location strategy.
  3. Copy Step: Copies the step to the step drawer for later use in this or another test case.
  4. Delete Step: Removes the step from your test.
  5. Clear Step Results: Clears any results from the execution of this step.
  6. Using the Alt Menu:
    • Press CONTROL + E or click on the toolbox icon next to the start test button to open the edit mode.
    • To disable a step, click on the checkbox next to it. Disabled steps will not be visible if the edit mode is closed and will not be executed.
    • To remove steps, open the edit mode and press the trash icon or right-click and select ‘Delete’.
    • Enable ‘Stop test session after execution’ to automatically close the browser and clear current variables after execution.

Using Groups

In JOSF we can use three different kind of groups for different purposes. Groups are located in the right menu directly under Teststeps and can be dragged in your script or added by double clicking it. The shortcuts for groups are the same, when the group is active in the step editor, double clicking on a step in the drawer will place the steps in the group. 

  • Descriptional Groups:
    • Descriptional groups improve readability without changing functionality.
    • Drag the ‘Descriptive’ block from the top right step drawer in your test.
    • Drag in steps or double-click on steps to place them inside the group.
  • Conditional Groups:
    • Drag the ‘Conditional’ block from the top right step drawer in your test.
    • The execution of this group depends on specific conditions or steps.
    • Expand the group by clicking on it to define the conditions in the step editor.
  • Repetitive Groups:
    • Drag the ‘Repeating’ block from the top right step drawer in your test.
    • This group will execute the steps in a loop using provided data, such as variable sheets.
    • Expand the group to define the looping data or variables.
  • Converting to Page Action:
    • Right-click on a group and select ‘Convert to Page Action’ to convert the steps into a page action.
    • To learn more about creating reusable blocks, please head over to our other video:
      ”Improve reusability in JOSF”

You can always change the type of a group by right-mouse click and then “change“ group type.


Debugging the Test

For debugging and checking your test you can use various built in buttons to have maximum control of the sequence you want to execute your teststeps.

  1. Play Button: Click the ‘Play’ button to run the test from the beginning.
  2. Pause Button: Use the ‘Pause’ button to pause the test execution. This button only shows up when the testcase is running.
  3. Resume Button: Click the ‘Resume’ button to continue the test from the paused state. This button only shows up when the testcase is in paused state.
  4. Step Over Button: Click the ‘Step Over’ button to execute the current step without going into any sub-steps. Like steps in a group, or steps of a page action.
  5. Step Into Button: Use the ‘Step Into’ button to execute the current step or in the case of groups and page actions,go into any sub-steps.
  6. Step Out Button: Use the ‘Step Out’ button to exit the current group or action and go to the current steps parent.
  7. Stop Button: Click the ‘Stop’ button to completely stop the test execution.
  8. Edit mode button: Enables edit mode to enable and disable steps, like pressing CONTROL + E.

Specific Debug Actions

In JOSF it’s possible to run steps separate from each other to debug steps that not working like expected. With this functionality you don’t have to run the full testcase before you can see where problems are. You can also run the script until a certain step, to execute the first part of your testcase.

  1. Step-Play Button/Next: Click the ‘Step-Play’ or ‘next’ button to execute the selected teststep.
  2. Run Script Until Here: Right-click on a step and select ‘Run Until Here’ to execute the test up to and including that step.

Test Results and Validation

After executing certain steps you always get a result indicator from JOSF. This indication can be colours, time executions, error messages, screenshots etc. When clicking on a executed step you will get more information about the execution. Some other special results can be found here:

API Requests/Responses: After executing the API step, view the request and response data of API steps in the results section.

Screen Images: On a webbrowser action enable take a screenshot, after executing the step, screenshots will be available for visual verification of webbrowser actions.

Validation Messages: Review any validation errors or successes in the results.

To clear results: Click ‘Clear Results’ in the edit mode to clear all results from previous executions.

Stop-After-Execution: To stop the browser and variabele context after test execution open the alt-view and click on the stop after execution button.


The bottom toolbar

The bottom toolbar is the last important feature in our toolbox, it allows us to inspect and control different aspects of the creation of testscripts.

First, we have the Open Test Session button. This feature allows you to create a new context for running your tests, complete with your environment variables and settings. It ensures that your test environment is properly started and ready to go. This will also be done when you press start at the top of your testscript.

Second, we have the Attach Browser function. This connects a new browser to your testing session, enabling you to test web actions on a browser realtime. It’s useful for visually inspecting how your steps interact with the web application and making any necessary adjustments.

The View Variables option is good for monitoring and debugging your tests. By clicking this, you can see all the variables currently in your testing session, giving you a clear overview of your test environment’s state. This helps in quickly identifying any issues or mis-set variables.

Similarly, the View Responses/Requests feature allows you to review all the API calls made during your tests. This section displays all the sent and received API steps, providing detailed insights into the interactions between your tests and the API endpoints. You can inspect the body, headers and statuscodes.

The last feature of the toolbar is the Command Line. This is where you can read the most logging of what happens whilst your test execution. You can also input a few commands to control filter or clear your console. These commands are: clear, filter and help.


Conclusion

Debugging tests in JOSF is a systematic process that, when mastered, can significantly improve the reliability and efficiency of your automated testing efforts. By leveraging the various tools and features within JOSF, you can create, debug, and refine your tests with confidence, ensuring that your software meets the highest standards of quality.

If you have any further questions or tips to add to this guide, feel free to reach out to us at JOSF@valori.nl. Happy testing!

In this document