Is it possible to have both Mobile and Web scripts for the same projects where Mobile app function is depend on the web part to be sync with the each other.But the issue i am facing in the driver conflict between them both.can it be possible to have it on the same project and performs the Test Simultaneously in the same Test case.
One answer may depend on how the behavior is delivered to the device. If the behavior is the same for both devices (delivered from a server back end, say), then your test objective is to verify that both can reach the behavior. In that case, I believe you have different tests - one test for each device because of UI differences.
If your test objective is to evaluate just the behavior, the device does not matter and you can evaluate the behavior independently of the device.
Can you elaborate on what driver conflict you are having?
Using Page Object Model Pattern
We should have a testcase that performs Web app automation in chrome after that we have to invoke the Mobile app after it.(Sync of Data should happen in between the applications).
We are using ChromeDriver for Webapplication and AndroidDriver for Mobile.On calling the methods from different class file in the Same Test.(We need to fetch the values from the Mobile App as the android element and use it in the web application part for of web Element)
I’m still unsure exactly what your conflicts are so this may not be what you are after. If what I am hearing is that you have the same / similar application in web as well as in the mobile I suggest you create one more level of abstraction. That is create an object that is the capacities of both pages. I.e. Login / Logout and then your implementation of the device specific part becomes more of implementations that fulfill the contract of the abstraction. Meaning that your test scripts work on the abstraction instead and is therefore the same and which one you use is a matter of setup.
First of all, I am going to assume that by Mobile and Web scripts you meant mobile native and web apps. If so, yes, it is possible to have test scripts for testing Mobile Web and Native all in one code base. It all boils down to the way you structure it.
If you are using the Page Object pattern, then the ids, implementation and reusable functions are separated. So in your scenario, say you need to click on a Login button which exists in the mobile native app and web app, in the login page. The way this would work is-
- Have separate id files for web and native app having different ids of elements in your application. In this case there will be a unique id for login button in mobile native app properties file and one for web app properties file.
- When you call the click method, you pass in the necessary ids from the above file into this reusable method
- Then the click happens according to what id you pass which is unique for mobile native and web app.
One advantage of this approach is now you just have one code base for both. You don’t need to maintain separate code bases.
The disadvantage of this approach is since you have one code base for both, maintenance is going to harder, especially if you have two separate native app and web teams and they are all making changes in one code base
Adding to what others have already mentioned,
This might be a useful read: https://autumnator.wordpress.com/2016/03/02/a-page-object-representing-both-desktop-and-mobile-views-or-website-and-mobile-app/. It might be simpler to keep separate location files for mobile vs web, but you if done right, you can also keep in one file, using location separator logic “,” for CSS selectors, pipe “|” for XPath, where left side locator value is for mobile and right for web or vice versa as a simplified example. This won’t work for simple locators by name, ID, class however.
And you can write a single integration test that covers making change from one UI (web) and verifying change in the other (mobile) and vice versa. You don’t need two separate tests to verify the integration. You just need instantiate 2 drivers in the same test and call the appropriate methods or page objects (regardless of whether you use same method/page object abstraction to handle both UI type implementations or separate ones for each). If the abstraction is done right, such an integration tests with two drivers should be easy to do.