Assertions in Appium studio

How can we assert element in appium studio.No options or command is available.Can we Create our own commands for the Assertions.

I use the TestNG for my assertion framework. If you are using an IDE, you can insert “assertions” into the generated code. You can’t add assertions directly into the Appium Server Console.

Experitest has added other commands that may help you, such as:

verifyElementFound(String, String, int)

For reference, take a look at:

https://docs.experitest.com/display/TD/Additional+Commands#AdditionalCommands-ElementCommands

1 Like

Ya i exported my code into eclipse…but that script results in some error.

Also i cannot see verifyelementfound command available in command area.i.am using community version.

please cut/paste the code for folks to look at.

Verifyelementfound command is not available in version 11.4.83 …Can you let me know in which version is this avaialbel

According to the Experitest Website, it should be available. You may need to use the SeeTest client wrapper to access it ??? Experitest, what say you ?

How will i use see test client wrapper?

Hi Komal,

If you want to use SeeTest Client you need to import the appium-seetest-extension-(VERSION) that is located in C:\Program Files (x86)\Experitest\AppiumStudio\clients\appium\java if you haven’t changed the installation directory.

If you have that imported into your code environment then that is fine.

While Using SeeTest Client, please notice:

seetest Client doesn’t replace Appium Driver but rather accompanies Appium driver throughout the test. You will still use Appium driver and only harness seetest Client power in those cases where Appium doesn’t support.

Here is an example code snippet:

public class SeeTestClientExample {
    private AndroidDriver driver;
    private SeeTestClient client;
 
    @Before
    public void setUp() throws Exception {
        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setCapability("app", EAndroidApps.ERI_BANK.absolutePath);
        driver = new AndroidDriver(new URL(SERVER_URL), dc);
         
        // Init the wrapper of driver
        client = new SeeTestClient(driver);
    }
 
    @After
    public void tearDown() throws Exception {
        if (driver != null) {
            driver.quit();
        }
    }
 
    @Test
    public void testMethodExists() throws Exception {
        // use the additional API method
        System.out.println(client.getDeviceLog());
    }
}

https://docs.seetest.io/display/SEET/seetest+Client

So we can see that we are passing driver into the SeeTestClient constructor. Now you have the ability to use additional commands not available by using only Appium.

As for the Assertions, you can add your own assertions in code environment by using libraries specific for TestNG, JUnit such as:

Assert.assertEquals(“Google”, driver.getTitle());

If you want to use Assertions in Appium Studio you are not able to do so, Appium Studio is there to help you create and test your scripts, but if you want to add additional commands that may not be available in Appium Studio, you can easily do that in your code environment.

If you have the ability to share more information with us then I’d be able to help out more.

@wakelt

According to the Experitest Website, it should be available. You may need to use the SeeTest client wrapper to access it ??? Experitest, what say you ?

Not all commands are available in SeeTestClient, for commands such as verifyElementFound you need to use Client that has all the capabilities that we offer instead of using SeeTestClient, but that is not part of Appium Studio, that is part of SeeTestAutomation.

1 Like

If VerifyElementFound is not usable in Appium Studio, then the Experitest Appium Studio website is incorrect. The ability to use VerifyElementFound within Appium Studio is documented at:

https://docs.experitest.com/display/TD/Additional+Commands

You can use some SeetestAutomation functionality from Appium Studio calling it as a script.

driver.executeScript("seetest:client.verifyElementFound(\"NATIVE\", \"xpath_of_item\"],0)");