junit - Automate real time data using java -


i new bee automation , java. working on problem requires me read read time stock market data database , verify same value seen on ui. ok having approximations 5% in value. verify if these tests have passed important me assert values value in ui.

i have small logic verify these values, wanted know if way of coding on java or have better way achieve these results.

alorigthm.

  1. i read int/float value db.
  2. calculate 5% of value in step 1.
  3. get value in ui , assert if greater or equal value in step 2.
  4. if greater asseert.assertequals(true,true) else fail assert.

if better way work these values, request better answer.

it's more usual have assertion represent meaning of test, having assert(true, true) not this. so:

 3. calculate absoluete difference between value obtained in step 1 , ui value (when absolute value, need remember ui might higher or lower db value, need make difference positive)  4. assert.assertthat( difference < thefivepercentvalue) 

also consider using hamcrest extension junit includes closeto() method.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -