4

I'm going to prepare e2e tests for chat app with two customer dashboards. First (written in Angular) is accessible from desktop browsers and second (Ionic) through mobile devices. When customer receives message from app user it should be visable in two dashboards etc.

The question is: what is the best way to structure automated tests for such feature?

Should I make some action in chat app, make assertion in first dashboard and after that do another assertion in second dashboard? It seems the best option because test cases will be almost the same for both.

2
  • 1
    It is good practice that tests are independent from each other. On the other side if you can make one scenario with 2 assertion it will do the job I guess.
    – Ramadan Jr
    Jul 3, 2018 at 8:45
  • Sure, I know independence is a part of all testing guidelines but in my case it will lead to duplication of code and test cases, so making two assertions after every step seems to be the best solution. Jul 3, 2018 at 21:31

2 Answers 2

1

In that case, have to initialize and keep two web driver objects up and running during test run.One for web browser and one for mobile app(using tools like appium).

After having this structure, you may switch between different driver objects depending on test step as having few steps/assertions in web browser and few in mobile app as part of single automation script.

As obviously, they will be using same test framework(like junit/testNG etc )for logging their assertion results so ultimately there will be single test result having both test step assertions outcome.

For switching between windows, you may get the handle and manipulate the desired window as below:

//For getting desired windows handle
  public String getMainWindowHandle(WebDriver driver) {
    return driver.getWindowHandle();
  }

//for switching to desired window
  driver.switchTo().window(openWindowHandle);
3
  • Do you think I can do the same with three browser windows and just switch between them in my test scenario? I'm not (yet) familiar with Appium but I can run mobile dashboard in desktop browser using a little manipulation in url address. I know using Appium would be better... Jul 3, 2018 at 21:23
  • Updated the answer with few code snippets. Jul 4, 2018 at 10:41
  • You have to further explore at your own. Jul 4, 2018 at 10:42
1

I would test the browser and the mobile app as if they are separate browsers.

Write the requirements for one test, have it run twice, once for each environment.

You could even have the two separate frameworks, one for each app, that call on the same set of test scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.