Exemplo n.º 1
0
        private void ParseTokens()
        {
            foreach (var t in Tokens)
            {
                if (t.Value != null && t.Value.Length > 0)
                {
                    // assign Url
                    if (t.Type == Token.TokenType.TOKEN_URL)
                    {
                        URL = t.Value; continue;
                    }

                    // assign testCase
                    if (t.Type == Token.TokenType.TOKEN_TC_DESC)
                    {
                        TestCase = t.Value; continue;
                    }
                }
            }
            Lines = new BrowserActionLine(Tokens);
        }
Exemplo n.º 2
0
        public void CanLoadBrowserActionLine()
        {
            var act1      = "click";
            var selector1 = "xpath";
            var locator1  = "//*[text() = 'Log In']";
            var act2      = "type";
            var selector2 = "id";
            var locator2  = "loginUserName";
            var act3      = "click";
            var selector3 = "name";
            var locator3  = "passwordField";
            var act4      = "type";
            var selector4 = "password";
            var locator4  = "//*[@id='password']";
            var list      = new List <Token>()
            {
                new Token(Token.TokenType.TOKEN_ACTION, 0, act1),
                new Token(Token.TokenType.TOKEN_ACTION, 1, selector1),
                new Token(Token.TokenType.TOKEN_ACTION, 2, locator1),
                new Token(Token.TokenType.TOKEN_ACTION, 0, act2),
                new Token(Token.TokenType.TOKEN_ACTION, 1, selector2),
                new Token(Token.TokenType.TOKEN_ACTION, 2, locator2),
                new Token(Token.TokenType.TOKEN_ACTION, 0, act3),
                new Token(Token.TokenType.TOKEN_ACTION, 1, selector3),
                new Token(Token.TokenType.TOKEN_ACTION, 2, locator3),
                new Token(Token.TokenType.TOKEN_ACTION, 0, act4),
                new Token(Token.TokenType.TOKEN_ACTION, 1, selector4),
                new Token(Token.TokenType.TOKEN_ACTION, 2, locator4),
                new Token(Token.TokenType.TOKEN_EOE, 4, null)
            };


            var lines = new BrowserActionLine(list);

            Assert.Equal(String.Join(" ", act1, selector1, locator1), lines.ActionLines[0].ToString());
            Assert.Equal(String.Join(" ", act2, selector2, locator2), lines.ActionLines[1].ToString());
            Assert.Equal(String.Join(" ", act1, selector3, locator3), lines.ActionLines[2].ToString());
            Assert.Equal(String.Join(" ", act2, selector4, locator4), lines.ActionLines[3].ToString());
        }