RedwoodHQ is a Server

Since RedwoodHQ is a multi-user test automation framework server it is assumed that multiple users will be able to login and work in it. As mentioned before, you should have only 1 RedwoodHQ server up and running while everyone connects to that IP address through their browsers (so no need to install anything for other users). Don’t be afraid for your data if this is just your test environment and you are planning to move to a more permanent one later on, just follow these Migration steps when you are ready to do so (if you are planning on keeping anything you create).

Add New User

In order for another person to use RedwoodHQ let’s create a new user first:

  1. Click on Settings tab
  2. Click on Add User button
  3. Type in the following values:
    - User ID = test
    - First/Last Name = Test User
    - Email = test@test.com
    - Password = test
    - Repeat Password = test
  4. Click on Submit button and you will see user ‘test’ appearing with the ‘Status’ red next to it (because that user is not logged in) like this:

Login as a New User

Now that new user is created, try to login with on either same machine as a current one or from a different machine altogether to simulate other user accessing RedwoodHQ.

If you just want to login on the same machine as where you are currently logged in as user admin then do this:

  1. In top right hand corner click on word ‘admin’ and click on Logout
  2. Click on Yes on prompt
  3. In the Login page type in:
    - Username = test
    - Password = test
  4. Click on Login button and you will get logged in as a test user

If you want to login from a different machine then do this:

  1. Open browser and type in the ip address of RedwoodHQ server machine + port number (typically 3000) that was specified during install (eg: http://192.168.44.554:3000). If you don’t know the IP address then just follow these steps on RedwoodHQ server machine
  2. In the Login page type in:
    - Username = test
    - Password = test
  3. Click on Login button and you will get logged in as a test user

Code and Git Repository

Each user has their own code they work with that is regulated by internal Git repository, so if my user test does any type of modification to the code and doesn’t ‘push it’ then other users will not see his changes. This is done so when a user works on their code, they are not concerned that they will interfere with other users code and executions and only push when they feel confident to do so. User also has an option when to Pull the code from main branch that was pushed by other users. Here is the scenario of how this works:

  1. As a logged in user ‘test’, click on Scripts tab
  2. Expand ‘src’ and ‘actions’ folders in left pane and double click on ‘CheckMovieTVReleaseDecade.java’ file
  3. Modify the code by adding a print statement and making xpath of element invalid and adding a new java import to handle println, so your code should look like this:
    package actions;
    import static java.lang.System.out;
    import actions.selenium.Browser;
    import org.openqa.selenium.*;
    import org.openqa.selenium.support.ui.Select;
    import java.util.*;
    public class CheckMovieTVReleaseDecade {
         public void run(HashMap<String, Object> params) {
    	out.println("This is a hello from user test!");
            WebElement element = Browser.Driver.findElement(By.xpath("//invalidxpath//img[@alt=\""+params.get("Date range value")+"\"]"));
            if((Boolean)params.get("Check") && (element.getAttribute("src").contains("checkbox_unselected"))){
                element.click();
            }
            else if (!(Boolean)params.get("Check")&& element.getAttribute("src").contains("checkbox_selected")){
                element.click();
            }
            try{Thread.sleep(4000);}catch(InterruptedException e){}
         }
    }
  4. Click on Build Scripts button (which will automatically save the script) and DO NOT click on Git Push yet
  5. Go to Execution ‘New Amazon Execution’ and run the ‘Add Star Wars to Cart’ test case (if you are not sure how, follow these steps in Quick Start 3)

Execution Analysis

Because we have purposely modified the script to fail by specifying invalid xpath, we see that the test case has failed and now it’s a good opportunity to see how we can analyze the results of it.

  1. While still in ‘New Amazon Execution’ click on ‘Add Star Wars to Cart’ link under Test Cases section to open Test Details for it
  2. In this section we can see all the actions that have passed, failed or not ran and their appropriate values
  3. Since ‘Check/Uncheck the Movie & TV Show Release Decade checkbox’ action has failed, it has expanded and contains screen shot, error and a stack trace
  4. Bellow Results there is a Logs section that shows all the print statements that were made by your code, in our case you should see ‘This is a hello from user test!’ print statement
  5. Click on ‘View’ button to have new tab open to show you a screenshot at which point the action has failed
  6. Close the screenshot tab and click on stack trace link ‘actions.selenium.CheckMovieTVReleaseDecade.run(CheckMovieTVReleaseDecade.java:10)’ which now goes to exact line failure on Scripts tab so you can fix it accordingly

Different User Different Result

Since user ‘test’ did not ‘push’ his code in, the other user ‘admin’ will not be affected by it. The only way user admin can get this code if user ‘test’ does a ‘Push’ and then user ‘admin’ does a ‘Pull’. Lets see this in action now.

  1. Login as a user ‘admin’
  2. Go to Execution ‘New Amazon Execution’
  3. You can see in that execution that the test case ‘Add Star Wars to Cart’ has failed because user ‘test’ has ran it with his code
  4. Now run this same ‘Add Star Wars to Cart’ test case and observe the results
  5. The test case has passed because user ‘admin’ doesn’t have the code which user ‘test’ does
  6. Click on ‘Add Star Wars to Cart’ link in execution to open Test Details
  7. All action steps are shown as Passed and we see that that under Logs there is nothing (because the print statement is also in users ‘test’ code)
  8. Login as a user ‘test’
  9. Open ‘CheckMovieTVReleaseDecade.java’ modify the xpath code to be valid again but keep the print statement so your code will look like this:
    package actions;
    import static java.lang.System.out;
    import actions.selenium.Browser;
    import org.openqa.selenium.*;
    import org.openqa.selenium.support.ui.Select;
    import java.util.*;
    public class CheckMovieTVReleaseDecade {
         public void run(HashMap<String, Object> params) {
    	out.println("This is a hello from user test!");
            WebElement element = Browser.Driver.findElement(By.xpath("//img[@alt=\""+params.get("Date range value")+"\"]"));
            if((Boolean)params.get("Check") && (element.getAttribute("src").contains("checkbox_unselected"))){
                element.click();
            }
            else if (!(Boolean)params.get("Check")&& element.getAttribute("src").contains("checkbox_selected")){
                element.click();
            }
            try{Thread.sleep(4000);}catch(InterruptedException e){}
         }
    }
  10. Click on Build Scripts button and then on Git Push button
  11. Login as a user ‘admin’
  12. Go to Scripts tab and open CheckMovieTVReleaseDecade.java
  13. Observe that print statement is not in the script yet
  14. Click on Git Pull button (computer with red arrow)
  15. Now the print statement that user ‘test’ pushed appeared and any future executions by user ‘admin’ will print that statement in the log when this action code is used

Feedback

Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment