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.

  • 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 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. – tiglatpilesar Jul 3 at 21:31

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);
  • 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... – tiglatpilesar Jul 3 at 21:23
  • Updated the answer with few code snippets. – V.A. Jul 4 at 10:41
  • You have to further explore at your own. – V.A. Jul 4 at 10:42

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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