Back from stasis

Hello again, long time no see! That’s the phrase I usually say 🙂

A lot of things have changed since my last post. Currently I’m working in Wrike as QAA Engineer. As my work is again (surprisingly!) related to web-development and web-testing, I’m planning to write a bunch of notes here about WebDriver and all this stuff. Stay tuned!

Posted in Uncategorized | Leave a comment

When you see warnings everywhere

Just got an email from one of online shops and one thing made me feel a bit uncomfortable. Can you guess why?

checkstyleV2

Yes, the answer is simple. The underline heavily reminds about CheckStyle

checstyle

Posted in Uncategorized | Leave a comment

Autologin in Windows

It required me some time to find an appropriate way to autologin into Windows 2102 Server. There are several ways of doing this but I found that typing

netplwiz.exe

In cmd is a good way to get things done and (as SO says) it this case it doesn’t store password in a clear way in registry.

It’s also stated that Autologon from Sysinternals can do the trick but I didn’t check it.

P.S. Some may notice it’s been a while I wasn’t here. I’ll write another post regarding this.

Posted in Uncategorized | Tagged | Leave a comment

Software Testing

Long time no posts, but I’m still alive and kicking!

Just finished an online course on Udacity — Software Testing.  Feels pretty interesting and not that hard to listen to (I was afraid my English skills degraded badly). However, still have to finish coding tasks, but there is a problem regarding these tasks. When I do something wrong, it shows something like “Incorrect. You’ve passed 3 out of 0 tests”, and I don’t get the point what is going wrong. 🙂 Also sometimes I don’t understand what exactly is needed from me, writing tasks’ text in python code doesn’t seem to be a good idea.

Anyway, I’m glad to watch this course and will continue with Software Debugging Automating the Boring Tasks. Hope to finish it and some other courses till the end of the year.

Posted in Uncategorized | Tagged , | Leave a comment

A few words about SmartClientWebDriver

Since I’ve touched SmartClientWebDriver at work, supporting a framework to test SmartGWT web-application, there is something I have to say. Do not agree to test SmartGWT’s applications!

Probably, I’m a bit harsh, but here is my point of view:

  • SmartClientWebDriver doesn’t have all information about what is implemented, why using their own driver instead of vanilla’s WebDriver, where to look for help and so on.
  • It doesn’t implement (or inherit) all methods WebDriver has. A short example: when test fails, it’s a good idea to make a screenshot to ease my life. Perhaps, it is just a connection issue and it’s a false-positive. Anyway, WebDriver has a possibility to make a screenshot of the browser’s window, but not SmartClientWebDriver. So the solution is… yes, pressing VK_PRINTSCREEN, the more stupid the more stable.
  • It has problems with timeouts (see my post)
  • Digging through autogenetated code is somewhat… uninteresting, to be polite.

In a nutshell, if somebody will ask me to work with SmartClientWebDriver again, the answer will be “NO!

Posted in Uncategorized | Tagged , | Leave a comment

A simple revelation about WebDriver

Continuing my last post:

We’ve managed to make our framework faster and more stable. The answer was quite easy – seems like SmartClient implementation of WebDriver works incorrectly with timeouts. So

WebDriver wait = new WebDriver(driver,timeout).withTimeout(5, TimeUnit.SECONDS).pollingEvery(1,TimeUnit.SECONDS);

didn’t work properly. We’ve changed our code to this one:

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

And it does the trick. Now we’re polling ~every 5 milliseconds and it works correctly. So I assume it is a bug in SmartClient WebDriver, but who cares, if we already have a workaround? 🙂

Posted in Uncategorized | Tagged , , | 1 Comment

One thing that disappointed me in Selenium WebDriver

Two days ago I was trying to speed-up our framework that eases work with Selenium Webdriver – we just write .xml files and then tests are working according to these files.

Whilst trying to do explicit wait, I mentioned one thing related to wait.until:

The functions’ return value if the function returned something different from null or false before the timeout expired.

So I need to do something like this because .withTimeout(30, SECONDS) .pollingEvery(5, SECONDS) doesn't seem to be working properly:

WebDriver wait = new WebDriver(driver,timeout).withTimeout(5, TimeUnit.SECONDS).pollingEvery(1,TimeUnit.SECONDS);

boolean check = true;

while(check){

try{

wait.until(ExpectedConditions.elementToBeClickable(By.xpath(xpath)));

break;}

catch (TimeutException ex) {continue;}}

 

I don’t catch NoSuchElementException as we don’t really care about it. The idea is that I want to check this element once or twice in a seconds and sometimes it works, sometimes not.

Posted in Uncategorized | Tagged , , | Leave a comment

Начало работы с GoogleTest

Мой первый пост здесь на русском, но так будет проще.

Столкнувшись недавно с необходимостью покрыть код тестами, я стал искать фреймворк для тестирования кода. Навскидку можно сразу же назвать несколько: xUnit, Boost Test Library, и GoogleTest (далее GT). Посмотрев несколько обзоров на хабре и stackoverflow, остановился на GT.

На первый взгляд, примеры выглядят не так уж и сложно. Однако возникает вопрос, как вообще добавить GT к своему проекту? На мой взгляд, с этим есть небольшие проблемы.

Сначала (на deb-based дистрибутивах):

1. sudo apt-get install libgtest-dev

Этот пакет установит всего лишь сорцы (i.e. header-files). Скомпилировать пакет нужно самому. Код теперь лежит в /usr/src/gtest

Идем в эту директорию, говорим

2. sudo cmake CMakeLists.txt && sudo make && sudo cp *.a /usr/lib

Последний шаг самый важный, мы сделаем копии полученных библиотек в /usr/lib, которые при установке libgtest-dev почему-то не устанавливаются.

Теперь, когда мы разобрались с установкой, мы можем попробовать написать и собрать самый простой пример.

#include <gtest/gtest.h>
#include <math.h>

double squareRoot(const double a)
{
double b = sqrt(a);
if(b != b) //nan check
{
return -1.0;
}
else
{
return sqrt(a);
}
}

TEST(SquareRootTest, PositiveNos)
{
ASSERT_EQ(6, squareRoot(36.0));
ASSERT_EQ(18.0, squareRoot(324.0));
ASSERT_EQ(25.4, squareRoot(645.16));
ASSERT_EQ(0, squareRoot(0.0));
}

TEST(SquareRootTest, NegativeNos)
{
ASSERT_EQ(-1.0, squareRoot(-15.0));
ASSERT_EQ(-1.0, squareRoot(-0.2));
}

int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

Объяснять здесь вроде особо нечего. У нас есть функция, вычисляющая квадратный корень. Мы покрываем её тестами, одни тесты проверяют корректность if-ветки, вторые – else-ветки. Потом мы запускаем прогон всех тестов.

Собирать будем командой

g++ -I usr/include/ test2.cpp -lgtest -lpthread -o test1

Запускаем test1, и получаем примерно вот что:

./test1
[==========] Running 2 tests from 1 test case.
[———-] Global test environment set-up.
[———-] 2 tests from SquareRootTest
[ RUN      ] SquareRootTest.PositiveNos
[       OK ] SquareRootTest.PositiveNos (0 ms)
[ RUN      ] SquareRootTest.NegativeNos
[       OK ] SquareRootTest.NegativeNos (19 ms)
[———-] 2 tests from SquareRootTest (19 ms total)

[———-] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (19 ms total)
[  PASSED  ] 2 tests.

Что предстоит дальше – добавить сборку в cmake, и как-то сделать всё это дело более кроссплатформенным (попробовать под виндой).

P.S. Идеи, как заставить всё это работать, да и код тоже, были бессовестно взяты с нескольких зарубежных блогов.

Posted in Uncategorized | Tagged , , | Leave a comment

gcc: decrease binary size, eliminate unused functions/code

In SuperTuxKart, we have ~80 unused functions and some of them are really big. As I’m not sure whether they’re needed or not, I’ve googled for special gcc options.

Some links so I don’t forget:

http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Compilation-options.html

http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ffunction-sections-973

http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-Wl-1104

By default gcc won’t eliminate unused data/functions, but we can do it manually. As a result – decreasing ‘supertuxkart’ binary by 80kb. Not epic, especially when you know that binary is 11mb in size.

Posted in Uncategorized | Tagged , , | Leave a comment

Please make me unsee it

Please make me unsee it

It was 2014…

Posted in Uncategorized | Leave a comment